InfoparkDailyCAREER TOOLS

JavaScript · Lesson 2 of 8

Variables & data types

let, const, strings, numbers, booleans, null and undefined.

Variables store values. Use const by default and let when the value will change. Avoid the old var.

  • String — text: "Kochi", or a template literal: `Hi ${name}`.
  • Number — 42, 3.14.
  • Boolean — true / false.
  • undefined — declared but not set; null — deliberately empty.
  • Objects and arrays — covered later.

typeof tells you a value's type.

Try it yourself

Edit the code and press Run (or Ctrl/⌘ + Enter). Code runs only in your browser, in a sandbox.

Key points

  • const by default, let if it changes.
  • Template literals use backticks and ${}.
  • typeof shows the type.

Quick check

Which keyword declares a variable that cannot be reassigned?

Practice task

Store a job title, salary and remote flag in variables and print one sentence about the job using a template literal.

Interview corner

var vs let vs const?

var is function-scoped and hoisted (avoid it). let and const are block-scoped; const can't be reassigned (but objects it points to can still change).

null vs undefined?

undefined means a value was never assigned; null is an intentional 'no value'.

Further reading

Official documentation, linked for deeper study. These are outside sites; this lesson's text is our own.

Original lesson written by the InfoparkDaily team · © 2026 InfoparkDaily · Free to learn — no paid course or subscription.