Guest User

Untitled

a guest
Jan 17th, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. var Array = []
  2. Array.push({'test':'fuu','url':'sdfsdfsdf'});
  3. Array.push({'test':'qsgbfdsbgsdfbgsfdgb','url':'sdfssffbgsfdbgdfsdf'});
  4. if($.inArray('fuu',Array) != -1) alert('present');
  5. else alert('absent');
  6. alert($.inArray('fuu',Array));
  7.  
  8. var arr = [];
  9. ...
  10. var found = false;
  11. $.each(arr, function () {
  12. if (this.test === 'fuu') {
  13. found = true;
  14. return false;
  15. }
  16. });
  17. if (found) alert('present');
  18.  
  19. Array.push({'test':'fuu','url':'sdfsdfsdf'});
  20.  
  21. $.inArray('fuu',Array)
  22.  
  23. $.grep(Array, function(key) { return key.test == "fuu" }); // Object
Add Comment
Please, Sign In to add comment