# JavaScript Syntax and Fundamentals

> Variables, operators, control flow, functions, arrays and objects: enough JavaScript to make a page interactive. Free notes, key concepts, resources and a mini...

Canonical: https://www.internhack.in/roadmaps/tracks/frontend/js-fundamentals
Last updated: 2026-11-28

Variables, operators, control flow, functions, arrays and objects: enough JavaScript to make a page interactive.

Beginner · about 12 hours · difficulty 2/5

Learn first: [HTML Document Essentials](https://www.internhack.in/roadmaps/tracks/frontend/html-document)

JavaScript is the only programming language browsers run natively, which makes it the centre of frontend work. Learn the language itself before any framework; frameworks change, the language underneath stays.

### Building blocks

- **Variables**: use `const` by default, `let` when you must reassign, and avoid `var` (function-scoped and hoisted in confusing ways).
- **Primitive values**: string, number, boolean, null, undefined, bigint, symbol. Everything else is an object (including arrays and functions).
- **Operators**: arithmetic, comparison (always prefer `===` over `==`), logical `&&`, `||`, and the nullish `??`.
- **Control flow**: `if`/`else`, `switch`, `for`, `for...of` (values of an iterable), `while`, `break`/`continue`.
- **Functions**: declarations, expressions and arrow functions; parameters with defaults; returning values.

### Arrays and objects

Most real code is data transformation. Get fluent with `map`, `filter`, `reduce`, `find`, `some`, `includes`, `sort` (beware: it mutates and sorts strings by default) and object access with dot and bracket notation. `Object.keys/values/entries` let you loop over objects.

### How to practise

Write small programs in the browser console or Node: a to-do list in memory, a word counter, a grade calculator. Read error messages carefully; they usually tell you the exact line and cause.

### Good enough to move on

You can write a function that takes an array of objects (say, products) and returns a filtered, sorted, transformed result without looking up the syntax, and you can debug it with `console.log` and breakpoints.

## Key concepts

- **const, let and var**
- **Primitive types and objects**
- **Operators and strict equality**
- **Control flow and loops**
- **Functions and arrow functions**
- **Array methods: map, filter, reduce**
- **Objects and property access**
- **Strings and template literals**
- **Debugging with console and breakpoints**

## Mini project

Build a command-line or console-based expense tracker: add, list, filter by category, and compute totals per month using only arrays, objects and array methods.

## Check yourself

What is the difference between for...of and for...in, and which one should you use to loop over an array?

## Free resources

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

Previous: [Transitions and CSS Animations](https://www.internhack.in/roadmaps/tracks/frontend/css-motion) · Next: [Types, Coercion and Equality](https://www.internhack.in/roadmaps/tracks/frontend/js-types-coercion)

## More in JavaScript: The Language

- [JavaScript Syntax and Fundamentals](https://www.internhack.in/roadmaps/tracks/frontend/js-fundamentals)
- [Types, Coercion and Equality](https://www.internhack.in/roadmaps/tracks/frontend/js-types-coercion)
- [Functions, Scope and Closures](https://www.internhack.in/roadmaps/tracks/frontend/js-scope-closures)
- [Objects, this and Prototypes](https://www.internhack.in/roadmaps/tracks/frontend/js-objects-prototypes)
- [Modern JavaScript and Error Handling](https://www.internhack.in/roadmaps/tracks/frontend/modern-javascript)

## Related

- [Roadmaps](https://www.internhack.in/roadmaps)
- [Frontend Developer Roadmap](https://www.internhack.in/roadmaps/tracks/frontend)
