Hi, I’m doing basic math practices and need to find out if they are ok, or what have I missed. Especially on Math 3, on which I’m getting “undefined” error no matter what I try. Codepen links below.
Source: https://developer.mozilla.org/en-US/docs/Learn/JavaScript/First_steps/Test_your_skills:_Math
Math 1: https://codepen.io/jcito14/pen/RwryPYM
Math 2: https://codepen.io/jcito14/pen/dyGeoEd
Math 3 : https://codepen.io/jcito14/pen/GRodNMQ
Hello @Juan_Salerno
hope that everything going fine with you
for the first task
finalResult = x *=y; this is fine but it also change the value of x
the required task can be solve like that finalResult = x *y; (your code is fine but it change x vlaue also)
to check a number is even use %2 if the result is 0 then is even
so evenOddResult = finalResult - 48; should be evenOddResult = finalResult%2;
so 2nd
this is fine result = result * result2; but the task want to be solved in that way
result *= result2;
i do not know why you write this line let finalResult = result.toFixed(2) - 4622.91;
you can fix it this way
let finalResult = result.toFixed(2);
console.log(typeof(finalResult)); // string
let finalNumber = Number(finalResult);
console.log(typeof(finalNumber)); // number
3rd
that cause you compare non existing variable (stromboli ==! strOmBoLi)
those are strings so you need to wrap them inside quote or simple use pwd1 and pwd1
so it be let pwdMatch = pwd1 === pwd2;
hope that help and have a nice day
Hi,
Thanks for the feedback. Will apply your suggestions shortly.