operator = Used for assignment.
The operator + is used to add values.
The arithmetic operator + is used to add values.
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 Operators are utilized to perform math on numbers (literals or variables).
The addition Operator (+) includes numbers:
var y = 3;
var z = x + y;
The multiplication Operator (*) 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 Operator (=) relegates an incentive to a variable.
The addition assignment Operator (+=) increases the value of a variable.
x += 4;
To add a space between two strings, you need to insert a space into a string:
txt3 = "Doe";
txt3 = txt1 + " " + txt3;
The aftereffect of txt3 will be:
The += task Operator can likewise be utilized to include (connect) strings:
txt1 += "nice day";
The consequence of txt1 will be:
Adding Strings and Numbers
Add two numbers and return the sum of the numbers. If the numbers are added to the string, return the string, as in the following example:
y = "4" + 4;
z = "Hi" + 4;
The consequence of x, y, and z will be: