Intro to JavaScript

... About 1 min

# Intro to JavaScript

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

Var Let and Const

1
2

2. What is the definition of a function?

Resuable set of statements to perform an action. 
1

3. What are the SOLID principles?

Single Responsibility, 
Open-closed principle,
liskov substitution principle,
interface segregation principle, and dependency inversion principle.
1
2
3
4

4. Given this array:

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

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

The pineapple's current position is [2] because arrays are zero indexed. 
1

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?

you.push(them.name)

1
2

6. Give an example of a JavaScript Conditional:

if (10 < 12){
  console.log("10 is less than 12" )
} 

1
2
3
4

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
i++
1

8. What does the DOM acronym stand for? Which file is first accessed to render the DOM?

Document Object Model. The first file to be accessed is the index.HTML file. 
1

9. What are the 9 ECMAScript types as defined by MDN?

 Numbers, Strings, Booleans, Undefined, Null, Symbol, objects, arrays, functions
1

10. When it comes to functions or methods, what is the difference between a parameter and an argument?

parameters are the variables you pass into a function while the argument is the action of the function. 

1
2

11. What is the difference between a primitive value and a reference value?

primitives store the actual value, while references store the route to the objects they refer to. 
1
Last update: September 23, 2021 04:13