Javascript Variables is a container for storing data values Example :
var x = 10;
var y = 5;
console.log(x);x is variable and store 10 as values y is variable and store 5 as values
Reference : w3schools, editor : wahyuamirulloh
Comments is syntax for developing purpose, comment doesn't executed to browser Example :
// This is a single-line comment
/* This is first multi-line comment
This is multi-line comment
this is the end of multi-line comment */// is used for write single line comment /.../ is used for write multi-line comment
Reference : w3schools, editor : wahyuamirulloh
You can assignment variable with (=) operators Example :
var x = 10;
var y = 5;You can perform arithmetic with javascript Example :
var x = 10;
var plus = x + 20;
var minus = x - 5;
var times = x * 20;
var divide = x / 2;
var modulus = x % 3;
var exp = x ** 2;(+) is for Addition (-) is for Substraction (*) is for Multiplication (/) is for Division (%) is for Modulus (**) is for exponentation
You can perform arithmetic more efficient with assignment arithmetic Example :
var x = 10;
x += 20;
x -= 5;
x *= 20;
x /= 2;