Comments are annotations in the source code, which are ignored by the interpreter. So, comments can be used to prevent the execution of the statements or text in the source code. Whenever we want to ignore somthing from the execution in the source code, we use comments. Comments can also be used to explain complex code logic, so the other developers can understand easily. There are two types of comments in javascript, such as-
Single line comments:-
// This is single line comment
document.getElementById("id").innerHTML = "Hello Tutorials Logic!";
Multi line comments:-
/*
This is multi line comment
*/
document.getElementById("id").innerHTML = "Hello Tutorials Logic!";
Variables are the containers in the memory which holds the data value and it can be changed anytime. In JavaScript variable can be declare by reserved keyword "var".
Standard Rules for JavaScript Variable Names:-
var x = 5; // Number
var Y = "Tutorials Logic!"; // String
var Z; // Declared without assigning a value
var x = 5, Y = "Tutorials Logic!", Z; // Multiple variable in a single Line