1
0
mirror of https://github.com/adambard/learnxinyminutes-docs.git synced 2025-08-10 16:54:33 +02:00

Updated javascript.html.markdown

Added some additional information on declaring variables.
This commit is contained in:
Xander Smalbil
2015-10-15 22:38:44 +02:00
parent 66bc42e31b
commit 841dcb5f09

View File

@@ -144,6 +144,10 @@ someOtherVar = 10;
// Variables declared without being assigned to are set to undefined. // Variables declared without being assigned to are set to undefined.
var someThirdVar; // = undefined var someThirdVar; // = undefined
// if you wan't to declare a couple of variables, then you could use a comma
// separator
var someFourthVar = 2, someFifthVar = 4;
// There's shorthand for performing math operations on variables: // There's shorthand for performing math operations on variables:
someVar += 5; // equivalent to someVar = someVar + 5; someVar is 10 now someVar += 5; // equivalent to someVar = someVar + 5; someVar is 10 now
someVar *= 10; // now someVar is 100 someVar *= 10; // now someVar is 100