how to make 5 elements with same value in array js code example Example: javascript repeat element in array Array(5).fill(2) //=> [2, 2, 2, 2, 2]