Let’s find out Variable, comment in JavaScript.

Variable

Variable are containers that hold values when you need to keep them.
It can convert to another value.


Varuables in JavaScript start with ‘var’.
‘var’ means to declear a variable.

1
2
3
4
5
var a = 10;
alert(a + 1);

var b = "hello !!";
alert(b)

Variable are able to have number, characters.

Comment

There are two type of comment in JavaScript

  1. //
    1
    2
    var a = 10;   // It is comment~!
    alert(a + 1);

‘//‘ is able to ignore the characters that follow.


  1. /*
    1
    2
    3
    4
    /*
    var a = 10; // It is comment~!
    alert(a + 1);
    */
    ‘/* */‘ is able to ignore the character which they covered code block.