Sitemap
Manish Mittal

Manish Mittal

🟨 Learn JavaScript in 7 Days — Day 1: How JavaScript Works + Data Types

2 min readNov 11, 2021

--

Welcome to Day 1 of your JavaScript learning journey! If you’re new to programming or switching from another language, this guide will help you build a solid foundation — one day at a time.

Today, we’ll cover two things:

  • 🔧 How JavaScript works behind the scenes
  • 📦 The different data types in JavaScript

🧠 What is JavaScript?

JavaScript is a programming language used to create interactive behavior on websites — like buttons that respond to clicks, popups, animations, and more.

It’s one of the three core technologies of the web:

  • HTML → structure
  • CSS → styling
  • JavaScript → behavior

⚙️ How Does JavaScript Work?

When you open a web page in your browser:

  1. The browser reads the HTML and CSS
  2. Then it finds and runs the JavaScript code
  3. That JavaScript code can update the page, respond to actions (like clicks), or fetch data

Browsers have something called a JavaScript engine (like Chrome’s V8) that converts JS code into instructions a computer understands.

Get Manish Mittal’s stories in your inbox

Join Medium for free to get updates from this writer.

📌 JS is interpreted (not compiled), single-threaded, and uses something called an event loop to handle async tasks like clicks or data loading.

📦 JavaScript Data Types (Primitive + Non-Primitive)

🟡 Primitive Types (Basic Units)

These are simple values:

Press enter or click to view image in full size
Javascirpt Primitive Data Types

Example

let name = "Alice";  // String
let age = 25; // Number
let isOnline = true; // Boolean
let empty = null; // Null
let notSet; // Undefined

🔵 Non-Primitive Types (Objects)

These are more complex:

  • Object → A collection of key-value pairs
  • Array → A list of items
  • Function → A reusable block of code
let person = {
name: "Bob",
age: 30
};

let fruits = ["apple", "banana", "cherry"];

✅ Day 1 Summary

  • JavaScript runs in your browser using a JS engine
  • It makes websites interactive
  • Data types help store and work with different kinds of values
  • Two main categories: Primitive and Non-Primitive

🔁 Quick Challenge

Create a variable for:

  • Your name (string)
  • Your age (number)
  • Whether you’re a developer (boolean)
  • Your hobbies (array)
let myName = "Jane";
let myAge = 22;
let isDeveloper = true;
let hobbies = ["reading", "gaming", "coding"];

🧭 Next Up — Day 2: Inbuilt Methods & Utility Functions

In the next article, we’ll explore JavaScript’s powerful built-in methods for strings, numbers, and arrays — tools you’ll use every day.

Day 2 Article

--

--