var programming_languages = [
"python",
"javascript",
"mongodb",
"json",
"java",
"html",
"css",
]
function randomWord() {
answer = programming_languages[Math.floor(Math.random() * programming_languages.length)];
}
Im complete beginner and this is not my code, so my question is how to make function with if statement that will write something in htlm when certain word in array gets picked. What i did was
<script>
function updateWord(){
if(programming_languages == [0]){
document.write("<h1>something<h1/>");
}
}
<script/>
In this case what im trying to do is when word "python" gets picked that html inputs something Thank you regards
Aucun commentaire:
Enregistrer un commentaire