im trying to have my function use an if else statement to determine whether or not a hypothetical salary is good enough and print the result back to my HTML page. .
I feel like the code im using in my if else statement is good, but it seems to be getting skipped over and when I print the results on the HTML, the variable “amount” is not displayed, but “salary” is
Advertisement
Answer
Remove let before amount in if else statements and the code will work as expected. The issue is, by using let again and again in if else statements, you’re declaring amount variable again and again. Read about scope of let to learn more.