benjaminvr

Codecademy - Break out of loop

Jul 20th, 2021
239
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const rapperArray = ["Lil' Kim", "Jay-Z", "Notorious B.I.G.", "Tupac"];
  2.  
  3. for(let i=0; i<rapperArray.length; i++){
  4.   console.log(rapperArray[i]);
  5.   if(rapperArray[i] == 'Notorious B.I.G.'){
  6.     break;
  7.   }
  8. }
  9.  
  10. console.log("And if you don't know, now you know.");
Advertisement
Add Comment
Please, Sign In to add comment