Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript

regarding conditional statement and loop together

var isEven = function(number) { // Your code goes here! var number = prompt("please enter your number to test wether it is even or odd"); while(isNaN(number) || number === "" ){ alert("please enter the valid number , you have entered the "+number); number = prompt("please enter your number again to test wether it is even or not"); } if(number % 2 == 0){ return true; }else{ return false; } };

isEven(); //whats wrong with the code? /*error - Oops, try again. Looks like your function returns false when number = 4. Check whether your code inside the if/else statement correctly returns true if the number it receives is even. */

1 Answer

Im sorry, what you are posting is confusing, go back to the code challenge, and at the question where you are stuck click on the ask for help button, and ask from there, it will let you append your code so it makes it easy for us to read and help you