LearnHub
Back to Tutorials
Programming

JavaScript Basics

Add interactivity to your websites with variables, functions, and events.

JavaScript is a programming language that makes web pages interactive. It can respond to user actions, update content, and communicate with servers.

Variables store data. You can declare them with let, const, or var. Functions let you group reusable code together.

Events allow you to run code when a user clicks a button, submits a form, or scrolls the page. Use addEventListener to attach event handlers.

Start small: create a button that changes the page color when clicked. From there, you can explore arrays, objects, loops, and conditional logic.