JavaScript Tutorial for Beginners
Learn by doing with this interactive tutorial.
This tutorial is designed for beginners. It will take you from knowing nothing about JavaScript to solving bite-sized JavaScript exercises when you're done.
You don't need to know anything about JavaScript to start. You'll be able to tinker with code and get immediate feedback right here in your browser.
Grab a cup of coffee, sit back, and relax!
Table of Contents
Strings
A collection of characters (letters, numbers, symbols) is known as a string. Strings must begin and end with quotation marks. Either single ' or double " will work, so long as you use the same at the beginning and end.
"edabit.com"The quotes are there to indicate the enclosed text is a value, not code.
Variables
The word "variable" means "can change"; they're used to store values that can change.
Let's use the keyword var to declare (i.e. create) a variable named animal:
var animal = "Fox"Check
After the equals = sign, enter the string "edabit.com". Remember that strings must be wrapped in quotes " ".