JavaScript Cheat Sheet
JavaScript Basics Let’s start off with the basics – how to include JavaScript in a website. Including JavaScript in an HTML Page To include JavaScript inside a page, you need to wrap it in <script> tags: <script type="text/javascript"> //JS code goes here </script> With this input, the browser can identify and execute the code properly. Call an External JavaScript File You can also place JavaScript in its own file and name it inside your HTML. That way, you can keep different types of code separate from one another, making for better-organized files. If your code is in a file called myscript.js, you would call it: <script src="myscript.js"></script><code></code> Including Comments Comments are important because they help other people understand what is going on in your code or remind you if you forgot something yourself. Keep in mind that they have to be marked properly so the browser won’t try t...