Array.ofbeginnerArray.of(42) // β [42] (element)
new Array(42) // β (42 empty slots) (length!)Array.of(n) with a single number creates a one-element array; new Array(n) creates n empty slots.
Because Array.of() is generic, it works with any value type. It is a clean, intention-revealing alternative to the literal [val] when you want to be explicit that you are wrapping a single value.
Challenge: Implement wrapInArray that takes any value and returns it inside a single-element array using Array.of.
wrapInArray(42) // β [42]
wrapInArray('hello') // β ['hello']
wrapInArray(null) // β [null]