http://www.w3schools.com/js/js_assignment.asp
JavaScript Assignment
JavaScript Assignment Operators
Assignment operators assign values to JavaScript variables.
Operator | Example | Same As |
---|---|---|
= | 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 assigns a value to a variable.
Assignment
var x = 10;
The += assignment operator adds a value to a variable.
Assignment
var x = 10;
x += 5;
The -= assignment operator subtracts a value from a variable.
Assignment
var x = 10;
x -= 5;
The *= assignment operator multiplies a variable.
Assignment
var x = 10;
x *= 5;
The /= assignment divides a variable.
Assignment
var x = 10;
x /= 5;
The %= assignment operator assigns a remainder to a variable.
Assignment
var x = 10;
x %= 5;
Test Yourself with Exercises!
반응형
'차근차근 > JAVA Script' 카테고리의 다른 글
JavaScript Functions (0) | 2016.02.15 |
---|---|
JavaScript Data Types (0) | 2016.02.15 |
JavaScript Arithmetic (0) | 2016.02.15 |
JavaScript Operators (0) | 2016.02.15 |
JavaScript Variables (0) | 2016.02.15 |