what does the $ mean in javascript code example
Example 1: what does -= mean in JavaScript
/* JavaScript shorthand -=
-= is shorthand to subtract something from a
variable and store the result as that same variable.
*/
// The standard syntax:
var myVar = 5;
console.log(myVar) // 5
var myVar = myVar - 3;
console.log(myVar) // 2
// The shorthand:
var myVar = 5;
console.log(myVar) // 5
var myVar -= 3;
console.log(myVar) // 2
Example 2: what does the ... mean in javascript
const x = [1,2,3,4,5];
Math.max(x) // NaN
Math.max(...x) // 5
// Math.max(...x) = Math.max(1,2,3,4,5)