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 ________________

A

paradigm

18
Q

A JavaScript class is defined with the ________ keyword.

A

class

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

A

this

21
Q

Objects are created from a class with the _______ operator

A

new

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
Q

TF A JavaScript class can only contain methods

A

True

26
Q

Functional programing is combining functions expressing ________ to do not ___________

A

what how

27
Q

The state of a program is the value of its __________ _________ at a given time.

A

global variables

28
Q

A pure function depends solely on its ___________ for computing its outputs

A

inputs

29
Q

A ______ . _______ is achange in a program state or interaction with the outside world

A

side effect

30
Q

Given the same data, a pure function will always produce the ___________ __________

A

same result

31
Q

The __________ method takes an array as a parameter and creates a new array with the results of calling a new function

A

map()

32
Q

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.

A

filter()

33
Q

The _________ method applied a provided function to each array element in order to reduce it to one value.

A

reduce()

34
Q

TF JavaScript is a multi-paradigm language

A

True