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.
Statements
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.Statements
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;
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;
Summary
Post a Comment