Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Does the hashbang (#!) have any functionality client side?

I recently learned about the hashbang syntax for writing comments in JavaScript, and need to know if it is or has the potential to be any different then just putting a // at the top of a file. Are there any conventions associated with the hashbang?

I am referring to usage in a browser environment only, not in a shell or NodeJS, etc.

I am asking because I am writing about JavaScript syntax and need to make sure it is 100% correct.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Hashbang has no meaning to JavaScript, as far as it’s concerned it’s just a comment. The only reason it exists is because Unix treats files beginning with #! specially when you try to run them as commands, and this can be used to run node.js automatically on a server.

This is meaningless in a browser, which loads scripts explicitly. So The hashbang has no special function on the client.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading