Categories
JavaScript Answers

How to Fix the ‘SyntaxError: identifier starts immediately after numeric literal ‘ Error in Our JavaScript App?

Spread the love

Sometimes, we may run into the ‘SyntaxError: identifier starts immediately after numeric literal’ when we’re developing JavaScript apps.

In this article, we’ll look at how to fix the ‘SyntaxError: identifier starts immediately after numeric literal’ when we’re developing JavaScript apps.

Fix the ‘SyntaxError: identifier starts immediately after numeric literal’ When Developing JavaScript Apps

To fix the ‘SyntaxError: identifier starts immediately after numeric literal’ when we’re developing JavaScript apps, we should make sure we don’t declare on reference variable names that starts with numeric literals.

For instance, the following code will all throw the error:

const 1bar = 'foo';
const foo = 1bar;
console.log(1.foo);

Instead, we write:

const bar1 = 'foo';
const foo = bar1;

which don’t start with a numeric literal.

Conclusion

To fix the ‘SyntaxError: identifier starts immediately after numeric literal’ when we’re developing JavaScript apps, we should make sure we don’t declare on reference variable names that starts with numeric literals.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *