var demo = document.getElementById("demo"); var fruits = [ "Apple", "Orange", "Mango", "Grapes", "Banana", ]; demo.innerHTML = fruits[Math.floor(Math.random() * fruits.length)];