What's Wrong? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

What's Wrong?

i made a code with if but it shows error on the else if https://code.sololearn.com/WIGQQ4y0k30i/?ref=app

3rd May 2017, 6:59 AM
Alex
Alex - avatar
3 Answers
+ 17
if (orange === C1) { iva = C1; document.write(price + iva); } else if (orange === C2) { iva = C2; document.write(price + iva ); } else if (orange === C3) { iva = C3; document.write(price + iva ); } else { document.write("Nothing Found"); } Semicolon are incorrect, replace with this. Bye.
3rd May 2017, 7:01 AM
Maz
Maz - avatar
+ 1
That 'var tot' you declared is a Native variable, meaning it can't simply change its value automatically when you call it back inside that 'if else' conditional expression.
3rd May 2017, 8:19 AM
Donny Gozali
Donny Gozali - avatar
0
try this var o = [.1,.25,.5]; var i=0; document.write((o[i]+1)*price );
3rd May 2017, 10:46 PM
Enrico Macchiavelli
Enrico Macchiavelli - avatar