//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") }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter