Intro to JavaScript
# Intro to JavaScript
1. Which keywords are used to declare a variable in JavaScript?
Var, Let, Const
2
2. What is the definition of a function?
A block of code designed to perform a particular task.
2
3. What are the SOLID
principles?
Single Responsibility
Open Closed
Liskov Substitution
Interface Segregation
Dependency Inversion
2
3
4
5
6
4. Given this array:
let fruit = ['apple', 'banana', 'pineapple', 'orange', 'strawberry']
What index is the pineapple's current position? How do you know?
2. Arrays start at 0,1,2,3....
2
5. With these two objects:
let you = { name:"You", hair: true, friends: [] }
let them = { name:"Them", hair: false, friends: [] }
2
how would you .push the them
object into the you
object's array of friends?
them.push(name)
2
6. Give an example of a JavaScript Conditional
:
if(taco < 2){
console.log("tacos")
}else{
console.log("taco")
}
2
3
4
5
6
7. In the for loop
below, what is the name of the piece belongs inside the empty "______" space? What would you put here to increase i
by one on every iteration?
for ( let i = 0; i < arr.length; _______ ) {
//...
2
Increment
i++
2
8. What does the DOM
acronym stand for? Which file is first accessed to render the DOM
?
Document Object Model. HTML Text is read first.
2
9. What are the 9
ECMAScript types as defined by MDN?
Primative Values: Boolean Type, Null Type, Undefined Type, Number Type, BigInt Type, String Type, Symbol Type
Objects
2
10. When it comes to functions or methods, what is the difference between a parameter
and an argument
?
Parameters are the names created when defining a function. Arguments are the values that the functions receives from the parameters when the function is invoked.
2
11. What is the difference between a primitive
value and a reference
value?
Primitive Values are data that are stored on the stack. References values are objects that are stored in the heap.
2