Answers for "create javascript array with 1 value"

0

create javascript array with 1 value

let arr = [42]       // Creates an array with only one element:
                     // the number 42.

let arr = Array(42)  // Creates an array with no elements
                     // and arr.length set to 42.
                     //
                     // This is equivalent to:
let arr = []
arr.length = 42
Posted by: Guest on July-06-2021

Code answers related to "create javascript array with 1 value"

Code answers related to "Javascript"

Browse Popular Code Answers by Language