JavaScript Basics and HTML Structure Guide
JavaScript Basics and HTML Structure Guide
6. It is the way in which an external JavaScript file is invoked from our HTML:
R/ <script src = "[Link]"></script>
7. In the following code, what is the result that will be displayed in the console?
var bills = [ [ 1 , 2 , 3 ] ,
[4,5,6]
[ 7 , 8 , 9 ] ];
[Link](bills[1][2])
R/ 6
8. It is the way to execute the function 'move' when the user presses any key:
R/ [Link]("keydown", mover);
9. If we want to declare a variable called message and assign it the text "I already know how to program", I do it
with the option:
R/alert("I already know how to program");
10. Why should we place the <script> tag right before the closing </body>?
R/ Because this way our page will be able to display something before executing the code
12. If you run the following code, what will be displayed in the console?
variable;
if(variable) { [Link]("works");
}
else { [Link]("does not work");
}
It doesn't work
- works
16. If I have the following code
[Link](variable);
function declare() { variable = 12; }
What will be displayed in the console?
R/ - 12
- variable = 12
var counter = 2;
var na = "na";
while(counter)
{
na += na;
contador -= 1;
}
[Link](na + " Freddy ")
24. In the following code, what is the value of the variable vida?
function pakiman(life)
{
life = life + life;
life++;
return life;
}
nombre: "Pakiman",
ataque: 101
};
[Link] = [Link] * 2;
27. To examine the HTML of any page with our browser, what is the tool that
do we use?
R/ The Element Inspector (Inspect) or View page source
28. What is the purpose of the 'alert' function in JavaScript and how is it invoked?
R/ Triggers an alert window in the browser, with the message that we configure; it runs
like:
alert(" My Message ");
33. When you want to start drawing in HTML, which tag helps us create a canvas?
R/ canvas