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.