Code Snippets Flashcards
1
Q
How do you remove duplicates from an array?
A
2
Q
How do you sort a numeric array?
A
3
Q
How do you convert a string to a an array? 
A
4
Q
How do you reverse an array?
A
5
Q
How do you break up a string where each word becomes an array entry?
A
6
Q
How can you deep clone an object in JavaScript? Provide an example.
A
const obj = { name: ‘John’, age: 30 };
const clonedObj = JSON.parse(JSON.stringify(obj));
console.log(clonedObj); // Output: { name: ‘John’, age: 30 }