JavaScript · Beginner level

Beginner level · Module 1 of 5 · 10 guided hours

JavaScript Setup and Basics

Run JavaScript in the browser and with Node.js, use the console, and work with variables, types, operators and strings.

Learning objectives

  • Run JavaScript in the browser console, a web page and Node.js
  • Declare variables with let and const and recognise JavaScript's types
  • Build text with template literals and calculate with operators

Topics

  • browser, DevTools console and Node.js
  • script tags and external files
  • let and const
  • number, string, boolean, null, undefined
  • operators
  • template literals

Lessons

  1. Lesson 1 Where JavaScript Runs

    Run JavaScript in the browser console, connect a script file to a web page and run the same code with Node.js.

    DevTools console<script src>Node.jsconsole.log

  2. Lesson 2 Variables and Types

    Store values with const and let, recognise JavaScript's main types and avoid common type surprises.

    const vs letnumber, string, booleannull and undefinedNumber() and typeof

  3. Lesson 3 Operators, Strings and Template Literals

    Calculate with arithmetic operators, build readable text with template literals and use common string methods.

    arithmetic operatorstemplate literals `${}`toFixed and toLocaleStringstring methods

Practical activity

Write a script that calculates a mobile-data bundle's cost per gigabyte for three offers and prints a comparison sentence for each.

Expected outcomes

  • JavaScript running in three environments
  • Correct small calculations printed as readable text

Assessment

Practical: complete a starter script that calculates and prints a shopping total; marked on correct values and use of const/let.

Free taster lesson JavaScript Fundamentals & Setup Read a free self-study lesson on this topic in the Free Course Library.

Taught live by an instructor — online or in person. Free course lessons are for self-study and do not lead to a certificate — see registration options.