Created
August 16, 2018 23:45
-
-
Save EsmailELBoBDev2/1f2a06adc7ef91c8e794cc5969441b4e to your computer and use it in GitHub Desktop.
To Make Songs Work When Specific Word Appear To User From ArrayList
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This Function For The Random Array List (Random Words) | |
let mainJS = function() { | |
let randomwords = [ | |
"I'm professional programmer", | |
"Noobest programmer you will ever see xD", | |
"So Dont Call Me Baby <br> -Ed Sheeran", | |
"Kiki Do You Love Me ? <br> -Drake" | |
]; | |
let randomItem = Math.floor(Math.random() * randomwords.length); | |
document.getElementById("randomwords").innerHTML = randomwords[randomItem]; | |
//----------------------------------------------- | |
/* This Function For The Songs (Witch Will Play When Specific Word Will Appear To User | |
From The Random Array List (Random Words) */ | |
let ed = new Audio("songs/ed.mp3"); | |
let drake = new Audio("songs/drake.mp3"); | |
if (randomItem ==2) { | |
ed.play(); | |
} else if (randomItem ==3) { | |
drake.play(); | |
} | |
} | |
mainJS(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment