1
2
3
4
5
6
7
8
9
10
To practice on your own, or to check code you believe shouldn't have been scored as incorrect, go to CodePen.
0,1,2,3,4,5,6,7,8,9
0
0
0
0
Code the short way of writing x = x + 1; Use either of the two legal expressions. | x++; or ++x; | (x\+\+)|(\+\+x);? | |
Code the short way of writing x = x - 1; Use either of the two legal expressions. | x--; or –x; | (x--)|(--x);? | |
In a single statement, increment the variable num and assign its new value to a second variable, newNum, which hasn't been declared beforehand. | let newNum = ++num; | letnewNum=\+\+num; | |
In a single statement, decrement num and assign its original value to newNum, which hasn't been declared beforehand. | let newNum = num--; | letnewNum=num--; | |
Using minimal code, decrement x. Use either of the two legal expressions. | x--; or --x; | (x--)|(--x); | |
What is the long version of x++? | x = x + 1; | x=x\+1; | |
In a single statement subtract 1 from a variable and assign the new value to another variable, which hasn't been declared beforehand. Both variables wind up with the same value. Make up both variable names. | let newNum = --num; | let[a-z_$][a-zA-Z0-9_$]*=--[a-z_$][a-zA-Z0-9_$]*; | |
In a single statement add 1 to a variable and assign its original value to another variable, which hasn't been declared beforehand. Make up both variable names. | let newNum = num++; | let[a-z_$][a-zA-Z0-9_$]*=[a-z_$][a-zA-Z0-9_$]*\+\+; | |
|
|||
|