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

Untitled

By: a guest on May 7th, 2012  |  syntax: None  |  size: 0.35 KB  |  hits: 18  |  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. how to check a value exists in javascript dictionary
  2. var arr = {} ;
  3.        
  4. if(jQuery.inArray("0", arr) != -1)
  5.        
  6. var x = { someProperty: 0 };
  7.        
  8. for(var p in x) {
  9.     if(x[p] === 0) {
  10.         //Found it!
  11.     }
  12. }
  13.        
  14. for(var p in x) {
  15.     if(x.hasOwnProperty(p)) {
  16.         if(x[p] === 0) {
  17.             //Found it!
  18.         }
  19.     }
  20. }
  21.        
  22. if(arr[0] != null)