Week 3 Review Flashcards

Review Week 3 Readings and FCC

1
Q

Loop over an array using “for”.

A
for (let i = 0; i < myArray.length; i++) {
  // Use myArray[i] to access each array element one by one
}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Loop over an array using for each

A
myArray.forEach(myElement => {
  // Use myElement to access each array element one by one
});
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Loop through an array using for-of

A
for (const myElement of myArray) {
  // Use myElement to access each array element one by one
}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Remove the 2nd, 3rd, and 4th element using splice

A

myArray.splice(1,3)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Splice syntax

A

Splice method with index of first element and second parameter is how many elements to remove

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

TF Strings are objects with methods and properties

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

TF A javascript string is immutable

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Convert a string to lower case

A

myString.toLowerCase()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Convert a string to upper case

A

myString.toUpperCase

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

TF You can use == to compare two strings

A

False use ===

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Access each letter of a string

A
for (let i = 0; i < myString.length; i++) {
  Console.log(myString[1]);
}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Access each letter of a string using for of

A
const name = "Sarah";
for (const letter of name) {
  console.log(letter);
}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Turn a string into an array

A
const name = "Sarah";
const nameArray = Array.from(name);
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What does
const song = “Honky Tonk Women”;
console.log(song.indexOf(“Onk”));
Return

A

-1 because string not found because case mismatch

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Break a string apart into array

A

myString = ’Jan, 12’

myString.split(“,“)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Find index of ‘r’ in string “Forrest”

A

myString = “Forrest”;

myString.indexOf(“r”);

17
Q

Object Orientated Programming or OOP is a programming ________________

18
Q

A JavaScript class is defined with the ________ keyword.

19
Q

What method is called during object creation

A

constructor()

20
Q

The keyword that represents the object on which a method was called

21
Q

Objects are created from a class with the _______ operator

22
Q

Javascripts OOP model is based on ___________

A

prototypes

23
Q

When trying to access a property that does not exist in an object, JavaScript then tries to find the property by in the ________ ________

A

prototype chain

24
Q

The method used to create a link between objects through prototypes

A

Object.create()

25
TF A JavaScript class can only contain methods
True
26
Functional programing is combining functions expressing ________ to do not ___________
what how
27
The state of a program is the value of its __________ _________ at a given time.
global variables
28
A pure function depends solely on its ___________ for computing its outputs
inputs
29
A ______ . _______ is achange in a program state or interaction with the outside world
side effect
30
Given the same data, a pure function will always produce the ___________ __________
same result
31
The __________ method takes an array as a parameter and creates a new array with the results of calling a new function
map()
32
The ___________ method offers a way to test every element of an array against a provided function. Only elements that pass this test are added to the returned array.
filter()
33
The _________ method applied a provided function to each array element in order to reduce it to one value.
reduce()
34
TF JavaScript is a multi-paradigm language
True