Skip to content

Instantly share code, notes, and snippets.

@yukop
Created March 18, 2012 15:48
Show Gist options
  • Save yukop/2075783 to your computer and use it in GitHub Desktop.
Save yukop/2075783 to your computer and use it in GitHub Desktop.
#codecademy Functions in JavaScript » Section 3
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 ;
};
if ( isLost(12) ) {
console.log('12 is a lost number');
}
if ( isLost(16) ) {
console.log('16 is a lost number');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment