Table of Content
Quiz time
Given the following code:
Question: What is the
$(function(){})
?- self invoked function. ✖ No. There is no () at the end.
- jQuery ready handling function ✔ Corrcet
Question: What is the usage of the beginning semi-colon
;
mark?- Prevent the function being treated as function argument ✔ During concatenation, in special case, this will happen:
someing_before(function....)()
- No use ✖ Sure it has a usage here
Question: When is the “app starts” printed to the console?
- After all the content and images loaded ✖ jQuery ready does not wait for images loading.
- After the DOM tree is loaded and elements are ready ✔ jQuery ready means the DOM/elements are ready to be reference.
Given the following code:
Question: Is
hello
a global variable?- Yes, it is in global scope. ✖ `hello` is local variable because var follows function scope.
- No, it is not accessible from global scope. ✔ var follows function scope. It exists until the function ends.
Question: Is
name
a global variable?- Yes, it is in global scope. ✔ `this` here refers to the global context, so `name` is accessible in global scope.
- No, it is not accessible from global scope. ✖ `this` here refers to the global context, so `name` is accessible in global scope.
What’s next? We’re going to take a look at “Project 3 – Welcome Screen”.