Skip to content

"SyntaxError: missing ; before statement" page still use 'var' #18265

@ozgurata

Description

@ozgurata

MDN URL

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Missing_semicolon_before_statement

What specific section or headline is this issue about?

"What Went Wrong?" and "Examples"

What information was incorrect, unhelpful, or incomplete?

The documentation still uses var keyword while the code examples are updated with const keyword

What did you expect to see?

const and let instead of var

Do you have any supporting links, references, or citations?

No response

Do you have anything more you want to share?

I can update it if needed but I wasn't sure if:

  1. var should be changed with just const
  2. var should be changed with const and let

If it's is the second choice, then:

  1. Should let be added to code examples too?

Lastly, when testing the code block via the Firefox developer console, syntax error changed to:

const foo = 'Tom's bar';
// Uncaught SyntaxError: unexpected token: identifier

[learn more] takes to this page but there is also a page provided for Unexpected Token error

MDN metadata

Page report details

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions