Guest User

Untitled

a guest
Jun 21st, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. function doSomethingWithArray(arr) {
  2.  
  3. doArray : {
  4.  
  5. // check the array
  6.  
  7. for (var i; i < arr.length; i++) {
  8. if (arr[i] === 0) {
  9. console.log('item at ' + i.toString(10) + 'is zero.');
  10. flag = true;
  11. break doArray;
  12. }
  13. }
  14.  
  15. /* do something w/ the array ... */
  16.  
  17. return arr;
  18. }
  19. return false;
  20. };
  21. doSomethingWithArray([1,4,6,3,5,8,0,1,2,7,3]);
Add Comment
Please, Sign In to add comment