I am new to learning JavaScript. I am starting to get the hang of it but I am reviewing lines of code that I got from a book I am learning from ("Head First") and I am having a bit of a hard time understanding when to use {}
Could you please help me understand?
function touchrock() {
if (userName) {
alert("I am glad that you have returned " + userName + "! Let's continue searching for your dream car");
} else {
userName = prompt("What is your name?");
if (userName) {
alert("It is good to meet you, " + userName + ".").onblur = setCookie;
if (navigator.cookieEnabled);
else alert("Sorry. Cookies aren't supported");
}
}
document.getElementById("lambo").src = "lamboandgirl.jpg";
document.getElementByID("lambo").onblur = setCookie;
}