JavaScript Shortcuts
Shorten simple if statements
Instead of: |
Do: |
---|---|
var myResult; |
var myResult = #var1==1 ? true : false; |
Shorten assignment operators
Note:Â the following examples assume local variables, if using a StudyTRAX variable precede the variable code with a 3.
Operator |
Shortcut |
---|---|
myCount = myCount + 1; |
myCount++; |
myCount = myCount - 1; |
myCount--; |
var1 = var1 + var2; |
var1+=#var2; |
var1 = var1 - var2; |
var1-=#var2; |
var1 = var1 * var2; |
var1*=var2; |
var1 = var1 / var2; |
var1/=var2; |