Defining with const
let a=[1,2,3]; let b=a; //Now b also refers (is an alias if you will) to b. b is not a copy of a.
By defining arrays with const, we are preventing changes to the reference.
const a=[1,2,3]; const fruits=[“apple”, “orange”, “banana”]; a=fruits; //Error
Iterating with for
There are three ways: Standard, OK, and modern but unoptimized.
However, the modern additions are meant for Objects and not Arrays.