Javascript Specific Flashcards
1
Q
What is the time complexity of trim()?
A
o(n)
2
Q
What time complexity is split()
A
o(n)
3
Q
What time complexity is .sort()
A
o(n log n)
4
Q
what time complexity is map()
A
o(n)
5
Q
What is the method and regex for removing all characters from a string but letters
A
.replace(/[^a-zA-Z]/g, “”)
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]]
}
}
7
Q
A