liveBook · Manning

JavaScript

As explained in Pro Angular 16

JavaScript is a programming language commonly used to implement behavior in web pages and client-side applications.

JavaScript is the language a browser executes to run a web application. Angular applications are written in TypeScript, a superset of JavaScript, but the browser receives JavaScript after the TypeScript-specific features have been removed. section 3.5

TypeScript asks developers to state the data types they expect. This makes development more predictable, but it does not change JavaScript’s type system. Understanding that distinction helps when a type annotation disappears from the code the browser runs. section 3.5 section 3.4

From application files to browser code

Run `ng serve` to build an Angular project. The TypeScript compiler converts TypeScript files to JavaScript; the Angular compiler converts template content and expressions into JavaScript statements that use browser APIs. Webpack follows imports from `main.ts` and bundles the resulting code for the browser. This describes the development build, not the deployment build. section 9.3.2

Table 9.7. The bundles produced by the Angular build process
Name
Description
main.js
This file contains the compiled output produced from the src/app folder.
polyfills.js
This file contains JavaScript polyfills required for features used by the application not supported by the target browsers.
runtime.js
This file contains the code that loads the other modules.
styles.js
This file contains JavaScript code that adds the application’s global CSS stylesheets.
vendor.js
This file contains the third-party packages the application depends on, including the Angular packages.

Use the bundle table to locate the application’s compiled code in `main.js` and distinguish it from runtime code, polyfills, styles, and third-party packages. section 9.3.2

How Pro Angular 16 covers it

How deep it goes
Introduces basic language features and the compilation path, but stops short of a comprehensive JavaScript guide.
Examples
Traces `ng serve` through compilation and import-driven bundling, with a table identifying the resulting JavaScript bundles.
What it assumes
Introduces HTML and JavaScript/TypeScript basics for readers without a firm grounding in web technologies.
What you can do after
Evaluate/understand why Angular source files differ from the JavaScript delivered to a browser.
How it connects
Connects JavaScript to TypeScript, HTML templates, browser APIs, Angular, and webpack bundling.

Also explained in

Compare how 12 books explain JavaScript →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Pro Angular 16. The section links point to the parts of the book it draws on.