#4 JavaScript Tutorials | Statements and comments




Statements in JavaScript –
A computer program is a list of “instructions” to be “executed” by a computer. In a programming language, these programming instructions are called statements. JavaScript program is a list of programming statements.
Most JavaScript programs contain many JavaScript statements. The statements are executed, one by one, in the same order as they are written.

Semicolons (;)
Semicolons separate JavaScript statements. On the web, you might see examples without semicolons.
Ending statements with semicolon is not required, but highly recommended.

JavaScript Comments –
JavaScript comments can be used to explain JavaScript code, and to make it more readable. JavaScript comments can also be used to prevent execution, when testing alternative code.

Single Line Comments (//) –
Single line comments start with //.
Any text between // and the end of the line will be ignored by JavaScript (will not be executed).

Multi-line Comments (/* */) –
Multi-line comments start with /* and end with */.
Any text between /* and */ will be ignored by JavaScript.

For Program code and more resources checkout this article –

Statements & Comments in JavaScript

Video by – Tanmay Sakpal
Simple Snippets Channel link – https://www.youtube.com/simplesnippets

Original source


43 responses to “#4 JavaScript Tutorials | Statements and comments”

  1. If you go to view => toggle wrap you can wrap each line of code so you don’t have to keep using the scroll bar! Also, for lazy people like me in html just put the ! And hit enter. This is for VScode

  2. I have a question, where can statements be used. I understood functions well and I experimented it in some features in web design. Does 'statements' have role in web development and where it can be used.

Leave a Reply