Overview

1 JavaScript is everywhere

JavaScript started as a quick browser scripting project, but over time it grew into a language used across websites, servers, mobile and desktop apps, consoles, and even devices like cars and IoT hardware. Its rise came through evolution: faster engines, shared standards through ECMAScript, and the expansion of runtimes like Node.js. The chapter emphasizes that JavaScript is no longer just for the browser; it is a general-purpose language whose reach is shaped by the environment in which it runs.

The text highlights several ideas that make JavaScript distinct from many other mainstream languages. Functions are first-class objects, the object model is prototype-based, and the language is single-threaded, relying on asynchronous patterns such as callbacks and promises. It also explains how modern JavaScript development is supported by new language features, transpilers, and polyfills, which allow developers to use newer syntax and APIs while still targeting older runtimes when necessary.

Beyond the language itself, the chapter surveys the framework-heavy ecosystem that supports modern development and warns about the tradeoffs that come with it. Web UI, server, and app frameworks make it easier to build complex products, but they can also contribute to slower performance, dependency problems, and coordination challenges in large teams. To address these issues, the chapter stresses best practices such as type checking with TypeScript, linting and formatting with tools like ESLint and Prettier, and testing at both unit and end-to-end levels, all of which help developers write safer, cleaner, and more maintainable code.

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

```html
Why does the book say JavaScript is “everywhere”?

JavaScript started as a browser scripting language, but it now runs in many places: websites, servers, mobile and desktop apps, game consoles, IoT devices, and even cars. Its growth comes from its evolution into a versatile language with many runtimes and tools.

What is Atwood’s Law, and why is it important in this chapter?

Atwood’s Law says that any application that can be written in JavaScript will eventually be written in JavaScript. The chapter uses this idea to show how JavaScript spread from browsers into many other domains.

What makes JavaScript different from languages like Java or C#?

JavaScript is more functionally oriented than many mainstream languages. Key differences include first-class functions, prototype-based object orientation, and a single-threaded execution model.

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 foundational JavaScript concept.

How do JavaScript runtimes and engines relate to each other?

A runtime is the environment that executes JavaScript, such as Node.js or a web browser. Under the hood, the runtime uses an engine, like V8 or JavaScriptCore, to turn JavaScript into machine instructions.

How does JavaScript get new language features?

New features are standardized through the ECMAScript process. Since ES2015, new ECMAScript versions have been released regularly, adding features such as arrow functions, maps, promises, and modules.

What are transpilers and polyfills used for?

Transpilers rewrite modern JavaScript into older syntax that more runtimes can understand. Polyfills add missing features in runtimes that do not provide them natively, such as implementing Promise support in older environments.

Why is TypeScript discussed as part of JavaScript development?

TypeScript adds type annotations and stronger tooling support to JavaScript development. It helps catch errors earlier, improves editor intelligence, and is widely used as a development tool for JavaScript.

What are the three best practices highlighted in this chapter?

The chapter emphasizes type checking, linting/formatting, and testing. These practices help catch mistakes earlier, improve code quality, and make projects easier to maintain.

What challenges does JavaScript face as it becomes more popular?

The chapter highlights several challenges: performance, collaboration at scale, and dependency management. These include code bloat, coordination between teams, package conflicts, and supply chain risks.

```

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