Javascript Specific Flashcards

1
Q

What is the time complexity of trim()?

A

o(n)

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

What time complexity is split()

A

o(n)

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

What time complexity is .sort()

A

o(n log n)

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

what time complexity is map()

A

o(n)

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

What is the method and regex for removing all characters from a string but letters

A

.replace(/[^a-zA-Z]/g, “”)

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

How do you a do a destructuring swap

A

for(let i = 0; i < matrix.length; i++) {
for(let j = i; j < matrix[0].length; j++) {
[matrix[i][j], matrix[j][i]] = [matrix[j][i], matrix[i][j]]
}
}

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