Assign qualities to factors and include them together:
var y = 3; //relegate the esteem 3 to y
var z = x + y; //allocate the esteem 7 to z (x + y)
Arithmetic administrators are utilized to perform math on numbers (literals or variables).
The addition administrator (+) includes numbers:
var y = 3;
var z = x + y;
The multiplication administrator (*) increases numbers.
var y = 3;
var z = x * y;
|=||x = y||x = y|
|+=||x += y||x = x + y|
|-=||x - = y||x = x - y|
|*=||x *= y||x = x * y|
|/=||x/= y||x = x/y|
|%=||x %= y||x = x % y|
The assignment administrator (=) relegates an incentive to a variable.
The addition assignment administrator (+=) increases the value of a variable.
x += 4;
The + administrator can likewise be utilized to include (connect) strings.
txt3 = "Doe";
txt3 = txt1 + " " + txt3;
The aftereffect of txt3 will be:
The += task administrator can likewise be utilized to include (connect) strings:
txt1 += "nice day";
The consequence of txt1 will be:
Adding Strings and Numbers
Adding two numbers, will restore the entirety, however including a number and a string will restore a string:
y = "4" + 4;
z = "Hi" + 4;
The consequence of x, y, and z will be: