Outline
Interviewers often want to know that you are very familiar with the JavaScript array. There are multiple ways to create an array:
- It is considered bad practice to use the array constructor:
const badExample = new Array()
- Assigning to a list of values between square brackets:
const example1 = [1]
- Creating an array from an existing array with Map or Filter:
const example2 = otherArray.map( (val) => val + 1 )