-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
18 lines (18 loc) · 844 Bytes
/
script.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
function calculateLove() {
const name1 = document.getElementById("name1").value.trim();
const name2 = document.getElementById("name2").value.trim();
if (name1 === "" || name2 === "") {
alert("Please enter both names.");
} else {
const lovePercentage = Math.floor(Math.random() * 101);
const result = document.getElementById("result");
result.innerHTML = `${name1} and ${name2}'s Love Percentage: ${lovePercentage}`;
if (lovePercentage <30){
result.innerHTML += "<br> Not a Great Match. Keeping Looling!"
}else if(lovePercentage >= 30 && lovePercentage < 70){
result.innerHTML += "<br> There is potential. Give it a try!"
}else{
result.innerHTML += "<br> Great Match! Love is in the Air!"
}
}
}