Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 48980

Incluse Javascript file

$
0
0

Hello every Body. I have creat a little script for test something.
I search a solution regarding the inclusion a Js file.

javascript:
const btn = document.querySelector(“ion-button”);
const fruits = [“banane”, “cerise”, “orange”, “raisin”, “ananas”];
const result = document.querySelector(".result");

function random(){
let fruit_random = Math.round(Math.random()*(fruits.length-1));
console.log(fruits[fruit_random])
result.innerHTML = fruits[fruit_random]

}
btn.addEventListener(“click”, random);

html:
html:





Fruit aléatoire

Veuillez cliquer sur le bouton
Salut
résultat

4 posts - 2 participants

Read full topic


Viewing all articles
Browse latest Browse all 48980

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>