Avoid parallel arrays.
If you want to represent a bunch of people who have names and ages, it’s cleaner to do
let people = [{name: “Buck”, age: 23}, {name: “Daniel”, age: 25}]
than
let names = [“Buck”, “Daniel”];
let ages = [23, 25];
The most important reason that the former is better is that it's easier to maintain consistency. It is very hard to totally break all your data by inserting a value incorrectly, while it is super easy to break all your data by inserting a value somewhere if you did it the second way.
The other reason that the former is better is that you can pass a person into a function with one
function call -- people[x]
is all the data about a person.