Chapter practice task
Task: Add a personal greeting to your portfolio
- Create
js/main.jsand link it withdeferat the end of your<head>. - Store your name and your number of years of experience in
constvariables. - Build a sentence with a template literal and log it to the console.
- Show the sentence on the page inside a
<p id="greeting">. - Change the greeting depending on the time of day (you’ll finish this in the next chapter).
By the end of this chapter
- You can add JavaScript to any page and open the console
- You know when to use
constandlet, and why to avoidvar - You understand strings, numbers, booleans, null, undefined, arrays and objects
Quick answers for this chapter
Where does JavaScript run?
In the visitor’s browser. Every modern browser has a JavaScript engine built in.
Do I need to install anything?
No. A browser and a code editor are enough.
What’s the console?
A panel in your browser’s DevTools where you can see messages and errors from your code and try out JavaScript.