Programming foundations

Stage 1 · Lesson 1 of 10

Values, types and let/const

Your first language

JavaScript values are numbers (one type covers whole numbers and decimals), strings, , null, undefined, objects and a few rarer . Declare names with const by default, and with let when you must reassign them. Both have : they exist only inside the nearest pair of curly braces.

var is the old form with confusing scoping rules, so leave it out of new code. const stops reassignment, not change: you can still push to a const array. JavaScript also converts types silently, which is called .

So "5" + 1 gives "51" while "5" - 1 gives 4. == converts both sides before comparing, while === (strict equality) does not. null and undefined both mean a , and it pays to check for them.

Use === everywhere, check a value's type with typeof, and convert input on purpose with Number(). These rules explain most of the strange output beginners hit.

A question to check yourself, an AI practice session and 4 cheat sheet entries come when you add the roadmap to your account. Add it

Resources for this stage

Start with· follow one of these

  • CoursePaid
    Grokking JavaScript Fundamentals

    Design Gurus · Beginner · $50

    The language itself, closures and async included, with runnable exercises per lesson

  • GuideFree
    JavaScript.info

    Ilya Kantor

    Free: Part 1 is the most complete modern JavaScript tutorial, with tasks per chapter

Practise

  • Small exercises in your language track, with free feedback from a human mentor

  • Foundations path: the JavaScript basics lessons and the exercises repo with tests

Keep handy

  • The JavaScript reference: look up every array and string method here

Mark this stage as not done?