Fundamentals
To use JavaScript on website we need to attach the JavaScript file to the HTML file. To do a better code, we should also do the commenting during the code. There are two types of commenting single-line and multiline.
- For a browser to know the code is written in JavaScript and execute it we must enclose the code within the <script> tag to include it on the HTML page.
<script type="text/javascript">
// Your js code goes here
</script>
- An external JavaScript file can also be written separately and included within our HTML file using the script tag as:
<script src="filename.js"></script>.
- JavaScript comments can be extremely useful to explain JavaScript code and help understand what’s going on in your code and make it more readable.
- Single-line comments: Start a single-line comment with “//”.
- Multi-line comments: Wrap the comment in /* and*/ if it spans multiple lines.
JavaScript Cheat Sheet – A Basic Guide to JavaScript
JavaScript is a lightweight, open, and cross-platform programming language. It is omnipresent in modern development and is used by programmers across the world to create dynamic and interactive web content like applications and browsers. It is one of the core technologies of the World Wide Web, alongside HTML and CSS, and the powerhouse behind the rapidly evolving Internet by helping create beautiful and crazy-fast websites.
This article provides an in-depth JavaScript Cheat Sheet, a must-have for every web developer.