Why isn't my Js code not printing onto the console my things? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Why isn't my Js code not printing onto the console my things?

At school we are learning about how percentages work but my classmates couldn't quite figure it out so i wanted to be a nice guy and make a nice calculator for them, i think my code should work but for some reason is not actually printing things onto the console could anyone help? link: https://code.sololearn.com/WE6dk2xoGgU8/#js Thanks in advance, -Milo

23rd Aug 2017, 6:24 PM
Milo Paolone
Milo Paolone - avatar
2 Answers
+ 8
@Sam, semicolons are not mandatory in Js, not in this case. :) You used the assignment operator rather than the comparison operator. You're checking the condition with an undefined "year" variable while you declared that variable as "years". These are the syntax errors, i didn't check the math behind the code. if( years == val ) console.log("...");
23rd Aug 2017, 6:31 PM
Maz
Maz - avatar
0
update: it was just Mozilla it works on google chrome although the math is horribly wrong and i would appreciate help on that
23rd Aug 2017, 6:30 PM
Milo Paolone
Milo Paolone - avatar