NBA generator

  • This is a button that will randomly generate a name from a great player in the NBA

This is how it works:


var players = ["Stephen Curry" , "LeBron James", "Michael Jordan", "Kareem Abdul-Jabbar", "Kobe Bryant", "Shaquille ONeal", "Larry Bird", "Wilt Chamberlain", "Magic Johnson"]

var button = document.getElementById("1")
        var random2 = document.getElementById("random")
        button.onclick=function() {
            let random = players[Math.floor(Math.random()*players.length)];
            random2.innerHTML = random
        }