Curriculum
Course: JavaScript Basic
Login

Curriculum

JavaScript Basic

JSHome

0/216
Text lesson

JavaScript Array with() Method

ES2023 introduced the Array.with() method, providing a safe way to update elements in an array without modifying the original array.

Example

const months = [“Januar”“Februar”“Mar”“April”];
const new = months.with(2“March”);

#! JavaScript Shebang

A shebang is a combination of a number sign and an exclamation mark (#!) placed at the beginning of a script.

#!/usr/bin/env node

The example uses a shebang (#!) to let the OS run the script with node, enabling ./fileName.js instead of node fileName.js.