JavaScriptBeginner
Transform each array element into a new array.
When to use it
Use it to compute a derived list without mutating the original.
JavaScript · Editable example
No visitor code executes on the WordPress server.
Edit this example or check its structure. For Python/SQL select Run for real browser-based output.
Live console
Expected output
[2,4,6]
Common mistake and fix
map() returns a new array; capture or use the return value.
Related concepts: array, callback, immutability
Explain this code
Transform each array element into a new array.
Open permanent reference page ↗
Educational examples are not a substitute for a real compiler or version-specific documentation. JavaScript, Python and SQLite demos run in isolated browser contexts when supported; Python and SQL load an online WebAssembly runtime on first use. Other languages receive structural hints, not compiler validation. No visitor code executes on WordPress.