Answers for "j avascript random"

0

js random

// using array and random example
function getTheBill() {
  let names = ["bob", "mike", "matt"];

  let randomFriend = Math.floor(Math.random() * names.length);

  let randomFriendBuyng = names[randomFriend];

  return randomFriendBuyng + " is buying us lunch today!";
}
Posted by: Guest on June-24-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language