The Lost Numbers

This one caused me slight confusion…

I completely forgot the return true/false…

 

1 thought on “The Lost Numbers

  1. var lost = [4, 8, 15, 16, 23, 42];
    var count = lost.length;

    var isLost = function (n) {
    for (var i = 0; i < lost.length; i++) {
    if (n === lost[i]) {
    return true;
    }
    }
    return false ;
    };

    if ( isLost(12) ) {
    console.log(’12 is a lost number’);
    }

    if ( isLost(16) ) {
    console.log(’16 is a lost number’);
    }

Leave a Comment