∑ 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, learn RegExp in 10 minutes, for beginner xahlee.info/js/js_regex_tutori

· Web · 0 · 0