Javascript Statement

JavaScript statements are composed of: Values, Operators, Expressions, Keywords, and Comments.This statement tells the browser to write "Hello." inside an HTML element with id="demo"

Example :-


In HTML, JavaScript statements are executed by the browser.

Hello dwtutorials

Note:Most JavaScript programs contain many JavaScript statements.The statements are executed, one by one, in the same order as they are written.

JavaScript Programs

A computer program is a list of "instructions" to be "executed" by a computer.In a programming language, these programming instructions are called statements.A JavaScript program is a list of programming statements.


Semicolons separate JavaScript statements.Add a semicolon at the end of each executable statement:

Example :-


JavaScript statements are separated by semicolons.


Line Length and Line Breaks

For best readability, programmers often like to avoid code lines longer than 80 characters.If a JavaScript statement does not fit on one line, the best place to break it, is after an operator:



The best place to break a code line is after an operator or a comma.
Hello dwtutorial!

Code Blocks

JavaScript statements can be grouped together in code blocks, inside curly brackets {...}.The purpose of code blocks is to define statements to be executed together. One place you will find statements grouped together in blocks, is in JavaScript functions:



JavaScript Statements

JavaScript code blocks are written between { and }