Intro to JavaScript

2021-8-16 About 1 min

# Intro to JavaScript

1. Which keywords are used to declare a variable in JavaScript?

Var, Let, Const

1
2

2. What is the definition of a function?

A block of code designed to perform a particular task. 

1
2

3. What are the SOLID principles?

Single Responsibility
Open Closed
Liskov Substitution
Interface Segregation
Dependency Inversion

1
2
3
4
5
6

4. Given this array:

let fruit = ['apple', 'banana', 'pineapple',  'orange', 'strawberry']
1

What index is the pineapple's current position? How do you know?

2. Arrays start at 0,1,2,3....

1
2

5. With these two objects:

let you = { name:"You", hair: true, friends: [] }
let them = { name:"Them", hair: false, friends: [] }
1
2

how would you .push the them object into the you object's array of friends?

them.push(name)

1
2

6. Give an example of a JavaScript Conditional:

if(taco < 2){
  console.log("tacos")
}else{
  console.log("taco")
}

1
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; _______ ) {
  //...
1
2
Increment
i++
1
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. 

1
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
1
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.

1
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. 

1
2
Last update: August 29, 2021 16:31
Contributors: Derek Shain