Skip to content
Advertisement

SyntaxError: identifier starts immediately after numeric literal, str_replace variable to javascript

so i have this variable

$number = "1944/UN31/KEP/2017" then i want to replace the "/" to "" so i create new variable:

JavaScript

i can access my $number variable to js before using (in laravel blade):

JavaScript

but when i replaced the string and the 2nd variable :

JavaScript

i got an error in my debuger saying : SyntaxError: identifier starts immediately after numeric literal

and its pointing out my 2nd varable value : 1944UN31KEP2017

can somebody pls help me… Thanks

Advertisement

Answer

Wrap with quotes

Change this:

JavaScript

to:

JavaScript

Hope this work for you !!!

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement