Love Calculator
Fri Apr 21 2023 17:48:35 GMT+0000 (Coordinated Universal Time)
Saved by
@AlanaBF
#javascript
//prompt for names
let name1 = prompt("What is your name?")
let name2 = prompt("What is your crush's name?")
//calculate random number between 1-100
let loveScore = Math.random()* 100;
loveScore = Math.floor(loveScore) + 1;
//alert user their percentage
//alert(name1 + " and " + name2 + ", your love score is " + loveScore + "%");
// alert using conditions
if (loveScore === 100) {
alert("Wow, " + name1 + " and " + name2 + ", your love score is " + loveScore + "%" + " you have a special kind of love! Marry each other right now!")
}
if (loveScore > 30 && loveScore <= 99) {
alert(name1 + " and " + name2 + ", your love score is " + loveScore + "%. Take your chances or go with your gut")
}
if (loveScore <= 30) {
alert ("oh dear, " + name1 + " and " + name2 + ", your love score is " + loveScore + "%. Your score is like mixing oil and water")
}
content_copyCOPY
Comments