Spoiler alert - this contains answer to ES6 Challenges, Use Destructuring Assignment to Assign Variables from Arrays.
If I omit the semicolon after b=6:
let a = 8, b = 6 // trailing semicolon omitted
(() => {
"use strict";
// change code below this line
[b,a] = [a,b]
// change code above this line
})();
I get the following error message: Uncaught TypeError: 6 is not a function
And if I do this (which also works when the semicolon is present):
let a = 8, b = 6 // trailing semicolon omitted
[b,a] = [a,b]
I get this error message: Uncaught ReferenceError: Cannot access ‘b’ before initialization
I thought trailing semicolons were optional (except in for loops).
The tests expect a semicolon to be there at the end of the variable assignment line. If you delete stuff outside of the // change code {below|above} this line, the tests will often break.
This is also why you will sometimes see a semi-colon in front of IIFEs in code to guard against this. Mainly an issue that happens when concatenating files.
;(() => {
"use strict";
// change code below this line
[b,a] = [a,b]
// change code above this line
})();