Use homogenous arrays to maintain sanity
· ☕ 1 min read
Use values with same types in any array. Changing types (even for scenarios that you think are totally valid for the day) can rain down hell.
Homogeneity of an array refers to using the same types of variables within an array.
The following arrays are homogenous -
1 2 3 4 const fruits = ['apple', 'orange]; const nums = [0,1,2] const answers= [true, false]; The following arrays are not -