What is the syntax error? | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
0

What is the syntax error?

I have no idea what I’ve done wrong but my scripts show a “syntax error”. https://code.sololearn.com/WK4kZG0WwWlW/?ref=app

4th Oct 2021, 3:37 PM
Margaret Guzman
Margaret Guzman - avatar
5 Antworten
+ 3
First of all your program doesn't print or show any output. Also I can't see you running calculate function anywhere. Here I fixed a problem for you: https://code.sololearn.com/WxxcT4qK1m53/?ref=app But according to the errors you had in your code you should go all over the js course again.
4th Oct 2021, 4:14 PM
Aleksei Radchenkov
Aleksei Radchenkov - avatar
+ 2
Go through lesson on if else again.
4th Oct 2021, 3:46 PM
Abhay
Abhay - avatar
+ 2
Your if block missing parenthesis (). Correct it. In code , for example: calories = (10 x weightKg) + (6.25 x heightCm) - (5 * age) - 1 61; And you are 'x' symbol for multiplication but its not multiplication symbol in coding. Use * symbol for multiplication. And ' - ' symbol also saying invalid. Correct it. And what is 1 61 there? It may be 1.61 So correct way : calories = (10 * weightKg) + (6.25 * heightCm) - (5 * age) - 1.61; Function definition missing () also. Read function syntax again once to know more.. call the function to use it. otherwise no use of it.
4th Oct 2021, 4:16 PM
Jayakrishna 🇮🇳
0
I changed the if else statements to switch statements and defined empty variables before calling them. Still syntax error
4th Oct 2021, 4:01 PM
Margaret Guzman
Margaret Guzman - avatar
0
Google it
6th Oct 2021, 6:19 PM
Sahil Naveed
Sahil Naveed - avatar