Getting started · Lesson 1 of 45
What is JavaScript?
Where it runs, and your first line of code.
Every website has 3 layers: HTML builds the structure, CSS styles and arranges it, and JavaScript makes it move and respond. When you click “Like” and the number goes up without a reload, that's JavaScript.
JavaScript was created in 1995 to run only inside browsers. Today people write servers (Node.js), mobile apps (React Native) and desktop apps (Electron) with it, and it's the only language every browser understands with no plug-ins.
HTML: structure
CSS: looks
JavaScript: behaviour
The trio every web page is made of.
Your first line
console.log() prints whatever you put between the brackets to the console, the place developers read their code's results and errors. Text goes inside quotes; numbers don't.
console.log("Hello, SeaCode!")
console.log(5 + 3)
console.log("5 + 3")Press “Run”, then change the text and run again.
How JavaScript gets into a page
<!-- inside the page -->
<script>
console.log("Hi from the page")
</script>
<!-- or from a separate file (better) -->
<script src="app.js" defer></script>Quick question
Which one makes a page respond when you click a button?
What's the output?
console.log("2 + 2")
console.log(2 + 2)What will this code print?
Exercise
Print your name on one line, and your age in 10 years on the next (as an addition).
// Write your code here
Learn more from
Played 0 of 3 games
Sign in to save your progress and earn XP.