# JavaScript Fundamentals

> Learn variables, types, functions, objects, arrays, scope and closures well enough that React and Node.js feel natural. Free notes, key concepts, resources and...

Canonical: https://www.internhack.in/roadmaps/tracks/full-stack/javascript-basics
Last updated: 2026-11-28

Learn variables, types, functions, objects, arrays, scope and closures well enough that React and Node.js feel natural.

Beginner · about 16 hours · difficulty 2/5

JavaScript is the foundation of everything else in this track. Weak JavaScript shows up later as confusing React bugs, so invest here.

### Language core

- **let and const** (avoid var), primitive types, and the difference between == and === (always use ===).
- **Functions**: declarations, arrow functions, default and rest parameters.
- **Objects and arrays**: destructuring, spread, optional chaining (?.) and nullish coalescing (??).
- **Array methods**: map, filter, reduce, find, some, every, sort. You will use map and filter in nearly every React component.

### Scope and closures

Variables live in block, function or module scope. A **closure** is a function that remembers variables from where it was created. React hooks, event handlers and middleware all depend on closures.

### Reference vs value

Objects and arrays are passed by reference. Mutating an array in place is the root of many "my React state did not update" bugs. Prefer creating new arrays and objects with spread or map.

### Modules

ES modules (import and export) split code into files. Both the browser and modern Node.js support them.

### Pitfalls

- Mutating shared objects by accident.
- Confusing this inside regular functions vs arrow functions.
- Learning a framework before you can write a plain function that groups and sums data.

You are ready to move on when you can take an array of placement offers and, without looking anything up, compute the average CTC per branch using map, filter and reduce.

## Key concepts

- **Variables and types**
- **Functions and arrow functions**
- **Objects, arrays and destructuring**
- **Array methods: map, filter, reduce**
- **Scope and closures**
- **Reference vs value**
- **ES modules**
- **Classes and prototypes**
- **Error handling with try/catch**

## Mini project

Write a Node.js script that reads a JSON file of placement offers (company, branch, CTC in lakhs) and prints per-branch averages, the top five offers and the number of companies, using only array methods.

## Check yourself

Explain what a closure is and give an example from event handlers or a counter function.

## Free resources

- [The Modern JavaScript Tutorial](https://javascript.info/) (javascript.info)
- [JavaScript Guide](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide) (MDN)
- [freeCodeCamp JavaScript Algorithms and Data Structures](https://www.freecodecamp.org/learn) (freeCodeCamp)

Previous: [Web Accessibility Basics](https://www.internhack.in/roadmaps/tracks/full-stack/accessibility) · Next: [The DOM and Browser APIs](https://www.internhack.in/roadmaps/tracks/full-stack/dom-and-browser-apis)

## More in JavaScript for the Whole Stack

- [JavaScript Fundamentals](https://www.internhack.in/roadmaps/tracks/full-stack/javascript-basics)
- [The DOM and Browser APIs](https://www.internhack.in/roadmaps/tracks/full-stack/dom-and-browser-apis)
- [Asynchronous JavaScript and fetch](https://www.internhack.in/roadmaps/tracks/full-stack/async-javascript)
- [npm, Packages and Build Tooling](https://www.internhack.in/roadmaps/tracks/full-stack/npm-and-tooling)

## Related

- [Roadmaps](https://www.internhack.in/roadmaps)
- [Full-Stack Developer Roadmap](https://www.internhack.in/roadmaps/tracks/full-stack)
