DEV Community

Cover image for When was JS Array.Map() first included? ES5? ES6?
raddevus
raddevus

Posted on

2 1

When was JS Array.Map() first included? ES5? ES6?

Wikipedia Versus W3Schools Throw-down!

wikipedia versus w3schools throwdown
I am attempting to discover when Array.Map() function was originally included in JavaScript.

wikipedia says it was ES6 (6th Edition – ECMAScript 2015) Read the paragraph the link takes you to and you will see it mentions... "new collections (maps, sets and WeakMap)..."

However, W3Schools says it was first included in ES5 (2009).

The link displays numerous items include Array.Map().

Do you know when it was first added?

Thanks

Answer My Own Question

Very interesting because I thought it was first added to ES6, however, I found the official ES5 (2009) Spec PDF and found the following:

es5 spec shows Array.map()

Of course, it is also defined in the ES6 Spec...

ES6 spec Array.map()

Was Just Wondering How Long It's Been Around

I had been under the impression it wasn't available until 2015, but it looks as if some browsers as far back as 2010 or so may have included it.

Top comments (0)

11 Tips That Make You a Better Typescript Programmer

typescript

1 Think in {Set}

Type is an everyday concept to programmers, but it’s surprisingly difficult to define it succinctly. I find it helpful to use Set as a conceptual model instead.

#2 Understand declared type and narrowed type

One extremely powerful typescript feature is automatic type narrowing based on control flow. This means a variable has two types associated with it at any specific point of code location: a declaration type and a narrowed type.

#3 Use discriminated union instead of optional fields

...

Read the whole post now!

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay