Ask coding questions

← Back to all posts
Question About Checking Values in Javascript
carouselcat (0)

This code is supposed to take in a number and check if it is equal to 10.
During testing, I get an error when checking for a number that would be false, and I'm not sure why.

What would be the best/correct way to go about this code?

timmy_i_chen (1011)

Seems to work for me, what are the expressions you are trying?

carouselcat (0)


I am doing the JS Auto-Graded Exercises on here, and the assignments are automatically tested, so I'm not sure what expressions are being tried.

If I am unsure of the expressions being tried, is there another approach I should be taking to writing the code?

kaldisberzins (281)

@carouselcat if it is an autograded assignment you should double check the instructions and check whether any functions that might be tested are spelled correctly. If the checking algorithm cannot find your function it will not be able to test it. Also, switch the == in the if statement to ===, see if that works.

timmy_i_chen (1011)

@carouselcat Lol this is actually a bug in the assignment.... I'll hop in and fix it. Whoops. Just skip it for now :P