∑ XahLee is a user on noagendasocial.com. You can follow them or interact with them if you have an account anywhere in the fediverse. If you don't, you can sign up here.

understand the complexity of Array Constructor

• new Array(…) → same as Array(…)
• Array() → same as []
• Array(n) → if n is 0 or 1, 2 etc, same as y=[];y.length=n. Else, same as [x].
• Array(a1,a2,a3) → same as [a1,a2,a3]

Examples:
xahlee.info/js/js_array_constr

∑ XahLee @xahlee

in Depth, understand ES2015 Array.prototype.copyWithin
xahlee.info/js/js_Array.protot

· Web · 0 · 0