+ 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

20th Jun 2020, 12:03 PM
Abhay
Abhay - avatar
5 Respuestas
+ 4
Logomonic Learning thank you for your valuable comment
20th Jun 2020, 12:50 PM
Abhay
Abhay - avatar
+ 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.
20th Jun 2020, 12:41 PM
Logomonic Learning
Logomonic Learning - avatar
+ 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
20th Jun 2020, 12:27 PM
Abhay
Abhay - avatar
+ 2
I just corrected it
20th Jun 2020, 12:51 PM
Abhay
Abhay - avatar
+ 1
Because √ is not a JavaScript operator. Use Math.sqrt(someNumber) or someNumber ** 0.5 instead.
21st Jun 2020, 2:10 AM
SapphireBlue
SapphireBlue - avatar