These are the instruction for the exercise I am supposed to do: Start with a prompt that asks the user to enter any string. Using a for loop, go through each character in the string. If the string contains the letter A (capital or lowercase), break out of the loop and print the message below to the screen. If the
Tag: var
different vars and ifs for different videos not working
I’m trying to create the function that if a key is pressed, a video appears. I have managed to do it for one key and it works fine: But i want to do this for several different keys, (26 to be exact). I figured that what I needed to do was copy the same code and place it below, like
What is the scope of variables in JavaScript?
What is the scope of variables in javascript? Do they have the same scope inside as opposed to outside a function? Or does it even matter? Also, where are the variables stored if they are defined globally? Answer TLDR JavaScript has lexical (also called static) scoping and closures. This means you can tell the scope of an identifier by looking