411 REFERENCE · Wikibooks
JavaScript/Lexical structure/Exercises
Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.
{Which line(s) lead to a syntax error?
/* 1 */ "use strict;"
/* 2 */ let a = 0
/* 3 */ let b = 0 //;
/* 4 */ let
/* 5 */ c = 0;
|type="[]"}
- Line 1
- Line 2
- Line 3
- Line 4
- Line 5
+ None of the above
{Which line(s) lead to a syntax error?
/* 1 */ "use strict;"
/* 2 */ let personName = "Hagar den skrækkelige";
/* 3 */ let Hägar = "Hägar the Horrible";
/* 4 */ let ä = "Hägar the Horrible";
/* 5 */ let Hägar = "Hagar den skrækkelige";
|type="[]"}
- Line 1
- Line 2
- Line 3
- Line 4
+ Line 5
- None of the above
{Which line(s) lead to a syntax error?
/* 1 */ "use strict;"
/* 2 */ let isOpen = true // or "true" ??? or TRUE ???
/* 3 */ isOpen = 5;
/* 4 */ let _isOpen = false;
/* 5 */ isOpen = _isOpen
|type="[]"}
- Line 1
- Line 2
- Line 3
- Line 4
- Line 5
+ None of the above
{Which line(s) lead to a syntax error?
/* 1 */ "use strict;"
/* 2 */ let countFiles = 5;
/* 3 */ countFiles = countFiles + /* or is it minus?? */ 1;
/* 4 */ countFiles = CountFiles * 2;
/* 5 */ // const twoFiles = 10;
/* 6 */ // const 2Files = 10;
|type="[]"}
- Line 1
- Line 2
- Line 3
+ Line 4
- Line 5
- Line 6
- None of the above
Be creative
Create a code snippet with 3 valid and 3 invalid variable declarations.
Create a code snippet with extensive comments, e.g.: explain WHY you have used certain variable names, whether this snippet is part of a huge project, what the author's name is, when the snippet was created, ... .
Create a code snippet and use non-Latin characters as variable names.