-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlc.js
More file actions
31 lines (27 loc) · 1.14 KB
/
lc.js
File metadata and controls
31 lines (27 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
document.getElementById('calculateButton').addEventListener('click', function() {
const name1 = document.getElementById('name1').value.trim();
const name2 = document.getElementById('name2').value.trim();
const resultDiv = document.getElementById('result');
let lovePercentage;
// Check for specific names
if ((name1 === "anandhu" && name2 === "akshara") || (name1 === "akshara" && name2 === "anandhu")) {
lovePercentage = 100;
} else {
lovePercentage = Math.floor(Math.random() * 101);
}
const cuteCatWords = getCuteCatWords(lovePercentage);
resultDiv.textContent = `${name1} ♥ ${name2} : ${lovePercentage}% ${cuteCatWords}`;
});
function getCuteCatWords(percentage) {
if (percentage >= 90) {
return '🐾 You two are purr-fect together!';
} else if (percentage >= 70) {
return '🐱 A meow-velous match!';
} else if (percentage >= 50) {
return '😺 Pretty good fur-real!';
} else if (percentage >= 30) {
return '😻 A cute combo, but needs work!';
} else {
return '🐈 Keep trying, lovebirds!';
}
}