r/javascript • • Sep 17 '22

New features in JavaScript 2022

https://olivernguyen.io/s/js2022/
0 Upvotes

15 comments sorted by

View all comments

3

u/ichsagedir Sep 18 '22

Hashbang is now supported. What is it? Why would you need it? This is not getting explained at all to me.

1

u/[deleted] Sep 19 '22

It's basically for people who want to run js scripts with or instead of bash scripts

1

u/ichsagedir Sep 19 '22

Thanks for trying to explain it to me but it still is very unclear for me. When would I need this on a webpage for example?

1

u/[deleted] Sep 19 '22

You don't need this on a webpage at all. This is for people making scripts to run on their own computers that just happen to be written in js.

The hash bang at the start of the file tells certain computers that the rest of the file should be run in node. (as opposed to being run as a bash or shell script)

The only change that js runners have made is that they won't error out on a hashbang line at the start of the file since it isn't really js. The js runners will now skip the hashbang and continue below.

2

u/ichsagedir Sep 20 '22

Thanks for explaining it further, I really had no idea. Since this article is about Javascript I thought it's something to do with JS in the browser. /u/olvrng maybe put information like that into your article so it makes sense?

1

u/olvrng Sep 20 '22

Thanks, I'll note it for next time.