Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Aug 9th, 2012  |  syntax: None  |  size: 0.31 KB  |  hits: 12  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. var lost = [4, 8, 15, 16, 23, 42];
  2. var count = lost.length;
  3.  
  4. var isLost = function (n) {
  5.   for (var i = 0; i < lost.length; i++) {
  6.     if ( n === lost[i]) {
  7.       return true;
  8.     }
  9.   }
  10.   return ;
  11. };
  12.  
  13. if ( isLost(12) ) {
  14.   console.log('12 is a lost number');
  15. }
  16.  
  17. if ( isLost(16) ) {
  18.   console.log('16 is a lost number');
  19. }