+ 5
[SOLVED]Why do i get this Syntax Error("unexpected token") in the following code
whenever i do √somenumber i get the above Syntax Error https://code.sololearn.com/WLiW8Yf4nkK6/?ref=app
7 Respuestas
+ 4
Logomonic Learning thank you for your valuable comment
+ 3
On a regular calculator, the square root is evaluated right after it is pressed. The sqrt symbol doesn't come before the number.
I also noticed that When the = is pressed it checks whether there is a sqrt root in the problem several times (depending on number of characters present.) Which isn't so efficient.
+ 2
𝐊𝐢𝐢𝐛𝐨 𝐆𝐡𝐚𝐲𝐚𝐥 thks for the suggestion ,but you could suggest me that privately or in comment on my code ,I really need to know why I am getting that error
+ 2
I just corrected it
+ 1
Because √ is not a JavaScript operator. Use Math.sqrt(someNumber) or someNumber ** 0.5 instead.