⛔lexical declaration cannot appear in a single-statement context❗️
Previousmissing initializer in const declaration❗️Nextdelete of an unqualified identifier in strict mode❗️
Last updated
Was this helpful?
Last updated
Was this helpful?
Was this helpful?
JS ⟩ error ⟩ SyntaxError ⟩ lexical declaration cannot appear in a single-statement context
// ⭐ "if" syntax:
// -----------------------------------------------------
// ╭──⭐───╮ <---- expecting a "statement"
// if (condition) statement;
// -----------------------------------------------------
// ╭──var──╮ <---- ✅ "var" is a "statement"
if (true) var a = 1;
// ╭── block ──╮ <---- ✅ "block" is a statement
if