if Statements March 23, 2026 by Zach Detlefs if Statements What does an if statement do in JavaScript? Runs code only when the condition is true asks the user what they would do if they were rich Runs code only when the condition is false None What will be printed when this code runs? let score = 10; if (score > 5) { console.log("You win!"); } You win! 10 5 Nothing, this code is wrong None Which of these is the correct way to write an if statement? if (x > 0) {..} if {x > 0} = {..} if x > 0, = {..} None Time's up Previous PostUnit G Quiz Next PostJavaScript Comprehensive Test Zach Detlefs Leave Your Comment Cancel Reply Save my name, email, and website in this browser for the next time I comment.