Hashbang
alias shebang
syntax introduced in JavaScript ES14.
Here is a syntax in Linux
#! /bin/bash
echo "Shell Script execution"
---
title: W3schoolsio ES14 Array immutable Methods
---
%%{init: {"flowchart": {"htmlLabels": false}} }%%
flowchart TD
markdown["`**ES14(ECMAScript2023)**`"]
hashbang["`**Hashbang** Grammar`"]
markdown --> hashbang
Es14 shebang syntax
If you want to run a nodejs program from the command line, hash bang syntax is used.
#! interpreter [optional-arg]
javascript code
The first line is a that starts with a hash symbol and exclamation mark (#!) followed by an interpreter with a
In Javascript test.js:
#!/usr/bin/env node
console.log("Shebang Supported in Javascript");
The first line is not valid JavaScript code, Interpreter ignores the first line Above shebang tells that JavaScript code runs with node command. By running ./test.js in the terminal, It prints the text.
$ ./test.js
Shebang Supported in Javascript
The above is equal to the node command.
$ node test.js
Shebang Supported in Javascript