Header add

In this article we will discuss how to write statements in JavaScript. Before you starting this aricle please refer our previous article of Introduction to Javascript.


In HTML, JavaScript statements are commands to the browsers. Each JavaScript statement should be terminated using ";" (semi colon) character. JavaScript code can also be grouped using opening braces "{" and closing curly braces "}". Let's see some examples related to JavaScript statements.

Let's print a text like "Welcome to CoreProgramm" inside an  HTML element with ID like below;

When we run the application it print the text as "Welcome to CoreProgramm" like below; In the below code snippet we have given document.getElementById in the script code, which returns the element with the Id "myId" in the HTML page.

Note : We are using online editor as stackblitz.

Program with Semi colon's, open & closed braces

Every statement should be ends with semi colon ';' and every JavaScript function can start and ends with open '{' and close '}' curly braces. The code looks like below as;

The final set of code are in stackblitz please find below; you can change here online and see the demo right now.

  In this tutorial we discussed how to write Statements in JavaScript. If have any question related to this topic then give your feedback.

You May Also Like...

Post a Comment

Previous Post Next Post