← Lesson
BitWithBite
JavaScript · Quick Reference

Lesson 1 — Introduction to JavaScript Cheat Sheet

JavaScript
In one line: JavaScript is THE programming language of the web — it makes websites interactive and alive. While HTML builds the structure and CSS styles it, JavaScript makes everything move,...

Key Ideas

1What is JavaScript?. JavaScript is THE programming language of the web — it makes websites interactive and alive. While HTML builds the structure and CSS styles it, JavaScript makes everyt...
2A Brief History of JavaScript. JavaScript has a fascinating (and rushed) origin story. Understanding where it came from helps you understand why it behaves the way it does — including its famous qui...
3Where JavaScript Runs. One of JavaScript's most powerful features is its versatility. It's not limited to websites — JavaScript now runs virtually everywhere.
4How to Add JavaScript to HTML. There are three ways to include JavaScript in a webpage. Each has its place — but one is almost always the best practice for real projects.
5console.log() — Your First JS Command. console.log() is the JavaScript equivalent of Python's print(). It outputs data to the browser's Developer Console — your best friend when writing and debugging JavaSc...

Code Examples

<!-- Inline JS — avoid in real projects --> <button onclick="alert('Hello!')">Click me</button> <button onclick="document.body.style.background='gold'">Turn gold</button>
<!DOCTYPE html> <html> <head> <title>My Page</title> </head> <body> <h1 id="title">Hello</h1> <script> // JavaScript inside the HTML file const title = document.querySelector('#title...
<!DOCTYPE html> <html lang="en"> <head> <title>My JS Project</title> </head> <body> <h1 id="greeting">Loading...</h1> <!-- Put script tag at end of body, before </body> --> <scrip...