JavaScript Flashcards

To gain a better overall understanding of everything JavaScript

1
Q

.includes

A

determines whether an array includes a certain value among its entries, returning true or false as appropriate.
- arr.includes(valueToFind[, fromIndex])

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

how do you prevent a submit button from refreshing the page when clicked?

A

in the handleSubmit function insert

e.preventDefault( );

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

what are two methods to convert a string to a number?

A
  1. add + directly before the element

2. type parse(int) directly before the element

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

a method that returns an array of a given object’s own enumerable property names, in the same order as we get with a normal loop.

A

Object.keys(obj name)
Return value is An array of strings that represent all the enumerable properties of the given object. The ordering is the same as a for loop.

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

will return an array from an object, but the array will contain more arrays that have both the key and value of the properties in an object.

A

Object.entries(obj name)

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

used to copy the values of all enumerable own properties from one or more source objects to a target object. It will return the target object.

A
Object.assign(target, ...sources)
target
The target object.
sources
The source object(s).
Return Value: The target object.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What do you call the object that a method belongs to?

A

The calling object

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

refers the calling object and can be used to access properties of the calling object.

A

The this keyword

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

What does the usage of an underscore before a property name mean?

A

that the original developer did not intend for that property to be directly changed.

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

allow us to create object instances quickly and repeatedly.

A

Factory functions

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

Name two ways to use object destructuring?

A

one way is the property value shorthand and another is destructured assignment.

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