Overview

1 JavaScript is everywhere

JavaScript began as a quick browser scripting project, but it has grown into a language that powers websites, servers, mobile and desktop apps, game consoles, and connected devices. That expansion happened through continual evolution: faster engines, standardized language features through ECMAScript, and runtimes such as Node.js that let JavaScript move beyond the browser. The chapter frames JavaScript as both unusually widespread and unusually adaptable, with TypeScript presented as an important companion that improves the developer experience without replacing JavaScript itself.

The text emphasizes that JavaScript works differently from many mainstream languages, especially because functions are first-class values, objects are prototype-based, and execution is single-threaded with asynchronous work handled through callbacks, promises, and workers. It also highlights the importance of understanding runtimes and engines, since code may run in browsers, Node.js, or other environments, each offering different APIs and support for newer features. Because language features arrive steadily, developers often rely on transpilers and polyfills to use modern syntax and APIs while still supporting older runtimes.

Beyond the language itself, the chapter surveys the framework landscape and the best practices that help developers write maintainable code. It contrasts browser UI frameworks, server frameworks, and app frameworks, showing how tools like React, Express, Electron, and React Native make it possible to build a wide range of applications. Finally, it stresses three key habits—type checking, linting/formatting, and testing—while also warning about common challenges such as performance bottlenecks, collaboration at scale, and dependency risks. Together, these ideas set up the book’s central message: mastering JavaScript means understanding both the language and the ecosystem around it.

How a JavaScript runtime brings JavaScript code to life.

Summary

  • JavaScript is everywhere. In addition to being the language of the web, it can be used to build applications for every major computing platform.
  • The JavaScript language has evolved dramatically over time, and continues to improve every year. However, depending on where you expect your code to run, you may need to transpile your code to take advantage of the latest features.
  • The vast majority of modern JavaScript projects are built using an open-source framework. Choosing the right framework for your project will give you a critical edge.
  • Best practices such as type checking, linting, and testing are key to writing robust, reliable code.
  • Some of the biggest challenges facing JavaScript developers are performance, collaboration at scale, and dependency management.
  • This book focuses on the core mechanics of the JavaScript language. Mastering those fundamentals will help you to architect, write, and maintain robust JavaScript applications.

FAQ

Why is JavaScript described as “everywhere” in this chapter?JavaScript is used far beyond web pages: in browsers, servers, mobile and desktop apps, game consoles, IoT devices, and even cars. The chapter emphasizes that its reach comes from how the language evolved over time and adapted to many environments.
What makes JavaScript different from many other mainstream languages?JavaScript is more functionally oriented than languages like C# or Java. Key differences include first-class functions, prototype-based object orientation, and single-threaded execution with asynchronous patterns like callbacks and promises.
What does it mean that functions are first-class objects in JavaScript?It means functions can be treated like other objects: assigned to variables, passed as arguments, returned from other functions, and created dynamically. This is a core JavaScript concept and a major part of writing idiomatic code.
How does JavaScript handle objects and inheritance?JavaScript uses prototypes rather than class-based inheritance. Modern JavaScript includes the class keyword, but those classes are built on top of prototypes under the hood.
Why is JavaScript considered single-threaded, and how does it handle asynchronous work?JavaScript runs in a single thread, so it uses asynchronous techniques such as callbacks and promises to handle tasks without blocking the main flow. For heavier work, workers can be used to delegate tasks outside the main thread.
What is a JavaScript runtime, and how is it related to an engine?A runtime is the environment that executes JavaScript code, such as a browser or Node.js. Inside the runtime, an engine converts JavaScript into machine instructions and often uses just-in-time compilation for better performance.
How do JavaScript runtimes differ from one another?Runtimes provide different API bindings for their host environments. For example, browsers offer APIs for the DOM and network requests, while Node.js provides APIs for sockets, files, and subprocesses.
How do new JavaScript features get added to the language?They are standardized through the ECMAScript Committee. New ECMAScript versions are released regularly, and runtimes adopt features over time, which is why developers must consider feature support across different environments.
What are transpilers and polyfills used for in JavaScript development?A transpiler converts newer JavaScript syntax into older syntax that more runtimes can understand. A polyfill adds missing functionality in environments that don’t natively support a feature, such as promises in older browsers.
What are the three major best practices highlighted in this chapter?The chapter emphasizes type checking, linting/formatting, and testing. Type checking helps catch type-related errors early, linting and formatting improve code quality and consistency, and testing verifies that code behaves correctly.

pro $24.99 per month

  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose one free eBook per month to keep
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime

lite $19.99 per month

  • access to all Manning books, including MEAPs!

team

5, 10 or 20 seats+ for your team - learn more


choose your plan

team

monthly
annual
$49.99
$499.99
only $41.67 per month
  • five seats for your team
  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose another free product every time you renew
  • choose twelve free products per year
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime
  • renews annually, pause or cancel renewal anytime
  • Secrets of the JavaScript Ninja, Third Edition ebook for free
choose your plan

team

monthly
annual
$49.99
$499.99
only $41.67 per month
  • five seats for your team
  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose another free product every time you renew
  • choose twelve free products per year
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime
  • renews annually, pause or cancel renewal anytime
  • Secrets of the JavaScript Ninja, Third Edition ebook for free