Control Flow


Hi, could someone explain why the below code is not working? This is for the control flow lesson 3. Thanks.
EDIT: It says 'unexpected string'. If that helps...

var input = function() {
    if (input = (isNaN = false) {
        return "The input will read.";
    } else {
        return "The input will not read.";
    } for (var i = input; i < 5; i++) {
        console.log("The input will read and is even.");
    } while (i % 2);


Your code is poorly structured and does not follow a few of Javascript's concepts to help you rectify your code i will point out the anomalies,

  1. This will result in an unexpected string error, and should also be stored in a variable
  1. Why are you checking your function name?
  1. i = input? does that seem correct? and also what is the purpose of the while loop at the end of your code?

//while loop syntax
while (true) {
    //some code


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.