- Take a piece of paper and draw the structure of this website
- Describe what a function is/does?
- How do I declare a function? and how do I run a function?
- Given the following code, what is the command to console log
hello world
?
var hello = function () {
return function () {
return function () {
console.log("hello world");
};
};
};
- Would the following code console.log
destroy the world
? or would it give you an error saying b is not undefined
? Explain your answer.
var a = "hello world!";
var myFunction = function() {
var b = "destroy the worl!";
}
myFunction();
console.log(b);
- Would the following code console.log
25
? or would it console.log 1
? Explain your answer.
var a = 5;
var myFunction = function() {
console.log(a*a);
}
var otherFunction = function () {
myFunction = function() {
console.log(a/a);
}
}
otherFunction();
myFunction();
- What is the difference between the following code?
function add (a) {
return a+a;
}
add = function (a) {
return a+a
}
- Which of these function would work, and which one would not? Explain your answer.
console.log(a())
console.log(b())
function a () {return "321"}
b = function () {return "123"}
- What is an object?
- What are ways to create an object?
- What does a property in an object contain?
- Given the follow object. Use
dot notation
to get "Fer"
and bracket notation
to get the "Denis"
var wdi = {
instructor1: "Fer",
instructor2: "Denis",
mysteriousInstructor: "Harry"
}
- How do I create a new property in the object above?
- How do I delete
mysteriousInstructor
in the object above?
- What is
this
and how do we use it?
- What is the
for loop systax
that is used to iterate through objects?