JavaScript Essentials

The JavaScript you need for React Native: values, functions, objects, arrays, modules and modern syntax.

Beginner · about 12 hours · difficulty 2/5

If you chose React Native, JavaScript is the ground you stand on. You do not need browser DOM knowledge, but you do need the language itself to feel natural.

What to learn

  • Values and types: strings, numbers, booleans, null, undefined, objects and arrays. Understand equality (===) and truthiness.
  • Variables: const by default, let when reassigning; avoid var.
  • Functions: declarations, arrow functions, default parameters, closures.
  • Objects and arrays: destructuring, spread (...), and array methods map, filter, reduce, find. React code uses these constantly to render lists and update state immutably.
  • Modules: import and export, named vs default exports.
  • Error handling: try/catch, throwing errors.

Pitfalls

  • Mutating arrays or objects in place (push, direct assignment) causes React state bugs; create new copies instead.
  • this behaves differently in arrow functions; modern React code rarely needs this at all.

Good enough to move on: you can take an array of product objects and produce a filtered, sorted list of names without mutating the original, and explain closures with an example.

Key concepts

  • Types, equality and truthiness
  • const, let and scope
  • Functions, arrow functions and closures
  • Destructuring and spread
  • Array methods: map, filter, reduce
  • ES modules
  • Immutability patterns
  • Classes and prototypes

Mini project

Write a small Node script that loads a JSON list of expenses, groups them by category with reduce, and prints totals sorted from highest to lowest.

Check yourself

Why does calling push() on an array held in React state often fail to update the UI?

Free resources