So i have made this code that when i click the check button it changes the text of message every time , depending on the number input in guess variable .
Though my logic to declare the variables in the beggining and then use them seems okey to me, it doesnt work Can someone explain why my logic is wrong?
// for example i declared
let message = document.querySelector('.message').textContent;
//and then i used message inside if to change the text
message = '‼ Type a Number';
why is this wrong?
document.querySelector('.check').addEventListener('click', function () {
let score = 20;
const guess = Number(document.querySelector('.guess').value);
let message = document.querySelector('.message').textContent;
if (!guess) {
message = '‼ Type a Number';
} else if (secretNumber === guess) {
message = 'You Won