Advertisement
Guest User

if & else condition

a guest
Aug 21st, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var saiful = ["saiful","saiful","saiful","saiful",545,2354,553,754,2535,"saiful","saiful","arif","saiful"],loop;
  2.  
  3. for (loop = 0; loop <saiful.length; loop++) {
  4.     if(saiful[loop] == 'saiful'){
  5.  
  6. console.log("Welcome to my house.");
  7.     } else {
  8.     //continue;
  9.     }
  10. console.log("the current name is " + loop + "\n");}
  11. VM549:6 Welcome to my house.
  12. VM549:10 the current name is 0
  13.  
  14. VM549:6 Welcome to my house.
  15. VM549:10 the current name is 1
  16.  
  17. VM549:6 Welcome to my house.
  18. VM549:10 the current name is 2
  19.  
  20. VM549:6 Welcome to my house.
  21. VM549:10 the current name is 3
  22.  
  23. VM549:10 the current name is 4
  24.  
  25. VM549:10 the current name is 5
  26.  
  27. VM549:10 the current name is 6
  28.  
  29. VM549:10 the current name is 7
  30.  
  31. VM549:10 the current name is 8
  32.  
  33. VM549:6 Welcome to my house.
  34. VM549:10 the current name is 9
  35.  
  36. VM549:6 Welcome to my house.
  37. VM549:10 the current name is 10
  38.  
  39. VM549:10 the current name is 11
  40.  
  41. VM549:6 Welcome to my house.
  42. VM549:10 the current name is 12
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement