The problem now I'm facing is functions call findRandom twice and get two different value at the end. How to make findRandom randomly pick a number and store it at one place where the number will be unchanged.
Expected result: all the functions share the same number or value.
getRandom = a.findRandom(0,1);
storeRandom = getRandom;
functionA() {
if (storeRandom = 0){
console.log("0");
}
}
functionB(){
if (storeRandom = 1){
console.log("0");
}
}
Aucun commentaire:
Enregistrer un commentaire