Eloquent JavaScript: A Modern Introduction to Programming
A comprehensive guide to modern programming using JavaScript. The course covers fundamental programming principles, the JavaScript language specification, web browser integration, and server-side development with Node.js, including five real-world project applications.
Visão Geral do Curso
📚 Content Summary
A comprehensive guide to modern programming using JavaScript. The course covers fundamental programming principles, the JavaScript language specification, web browser integration, and server-side development with Node.js, including five real-world project applications.
A deep and elegant dive into the heart of JavaScript programming.
Author: Marijn Haverbeke
Acknowledgments: Supported by 454 financial backers; illustrations by Wasif Hyder, Max Xiantu, Margarita Martínez, José Menor, Jim Tierney, Dyle MacGregor, Jeff Avallone, Thomas Palef, and Antonio Perdomo Pastor.
🎯 Learning Objectives
- Define what a program is and explain the different levels of abstraction in computer languages.
- Utilize JavaScript numbers and arithmetic operators to produce values.
- Declare and update variables while adhering to naming conventions and reserved word restrictions.
- Implement robust control flow using
doloops,forloops, andswitchstatements while maintaining clean code via indentation and comments. - Define and invoke functions using multiple notations, handling parameters, optional arguments, and nested lexical scopes.
- Apply advanced functional concepts such as recursion, closures, and the call stack to solve complex algorithmic puzzles.
- Utilize specialized object and array methods to manage complex data structures and strings.
- Implement higher-order functions (
filter,map,reduce) to abstract logic and compose data transformations. - Navigate and manipulate the prototype chain to create structured, reusable object instances and polymorphic interfaces.
- Implement polymorphic interfaces to handle complex data visualization (tables).
🔹 Lesson 1: JavaScript Fundamentals and Program Structure
Overview: This lesson introduces the foundational concepts of programming using JavaScript, moving from the philosophical definition of a program to the practical mechanics of code. Students will explore how data is represented through types and bits, how to manipulate values using operators, and how to structure programs using variables, expressions, and statements. The lesson also covers JavaScript’s unique behaviors, such as automatic type conversion and short-circuit evaluation.
Learning Outcomes:
- Define what a program is and explain the different levels of abstraction in computer languages.
- Utilize JavaScript numbers and arithmetic operators to produce values.
- Declare and update variables while adhering to naming conventions and reserved word restrictions.
🔹 Lesson 2: Functions and Complex Data Structures
Overview: This lesson explores the essential building blocks of structured programming, focusing on advanced control flow, functional programming techniques, and complex data organization. Students will master how to encapsulate logic within functions, manage variable visibility through scopes and closures, and manipulate mutable objects to analyze real-world data like statistical correlations.
Learning Outcomes:
- Implement robust control flow using
doloops,forloops, andswitchstatements while maintaining clean code via indentation and comments. - Define and invoke functions using multiple notations, handling parameters, optional arguments, and nested lexical scopes.
- Apply advanced functional concepts such as recursion, closures, and the call stack to solve complex algorithmic puzzles.
🔹 Lesson 3: Higher-Order Functions and Prototypes
Overview: This lesson explores the transition from basic data manipulation to advanced functional and object-oriented patterns in JavaScript. It covers efficient data storage using Maps and global objects, the power of higher-order functions to abstract actions (filtering, transforming, and summarizing), and the underlying mechanics of the JavaScript object system, including prototypes, constructors, and polymorphism.
Learning Outcomes:
- Utilize specialized object and array methods to manage complex data structures and strings.
- Implement higher-order functions (
filter,map,reduce) to abstract logic and compose data transformations. - Navigate and manipulate the prototype chain to create structured, reusable object instances and polymorphic interfaces.
🔹 Lesson 4: Object Orientation and Error Management
Overview: This lesson explores advanced object-oriented patterns in JavaScript, focusing on polymorphism through table layout interfaces and the design of a simulated ecosystem ("Electronic Life"). It transitions into software reliability by covering the "Strict Mode," debugging techniques, and the importance of structured testing to mitigate common programmer mistakes.
Learning Outcomes:
- Implement polymorphic interfaces to handle complex data visualization (tables).
- Contrast inheritance and composition to build extensible object structures.
- Manage the execution context (
this) within higher-order functions and object methods.
🔹 Lesson 5: Pattern Matching and Modularization
Overview: This lesson covers the dual requirements of modern programming: processing complex string data and organizing code into maintainable structures. Students will learn to use Regular Expressions to describe and manipulate text patterns, followed by an exploration of Modularization to isolate code, manage namespaces, and facilitate reuse.
Learning Outcomes:
- Construct and test regular expressions using literal and constructor notation.
- Implement advanced pattern matching techniques including grouping, backtracking, and non-greedy repetition.
- Apply modular design principles to prevent namespace pollution and decouple program components.
🔹 Lesson 6: Language Design and the Web Environment
Overview: This lesson explores the transition from structured software design to the creation of a custom programming language called "Egg." It further bridges these concepts into the Web environment, detailing how networks, HTML, and the Document Object Model (DOM) create a programmable interface for browsers. Students will learn to manage code complexity through modularity and manipulate live web documents using JavaScript.
Learning Outcomes:
- Implement robust module systems using the
definefunction and manage complex dependencies. - Construct a functional parser and evaluator for a domain-specific language, including scoping and function support.
- Explain the architecture of the Web, including TCP/IP, HTML structure, and the security implications of the browser sandbox.
🔹 Lesson 7: Events and Interactive Platforms
Overview: This lesson explores the synergy between Document Object Model (DOM) manipulation, CSS styling, and complex event handling to create interactive web experiences and games. Students will learn to control layout and animation, manage the asynchronous nature of user inputs, optimize performance through timing techniques, and architect a grid-based platform game using object-oriented principles.
Learning Outcomes:
- Manipulate DOM Layout and Styles: Use JavaScript to read element dimensions, apply cascading styles, and animate elements using CSS positioning and trigonometry.
- Master Event Orchestration: Implement advanced event handling including propagation control, preventing default actions, and managing specialized events (keyboard, mouse, scroll, and focus).
- Optimize Script Execution: Apply web workers for background processing and utilize debouncing/throttling to manage high-frequency events.
🔹 Lesson 8: Canvas Graphics and Network Protocols
Overview: This lesson explores the transition from DOM-based game rendering to the high-performance HTML5 Canvas API, alongside the fundamental mechanics of 2D platformer physics. Students will learn to implement complex game logic including gravity and collision detection while mastering imperative drawing techniques. Additionally, the lesson introduces the HTTP protocol and the XMLHttpRequest object for handling client-server communication.
Learning Outcomes:
- Implement grid-based collision detection and gravity-driven motion in a game environment.
- Utilize the HTML5 Canvas API to render paths, curves, images, and animated sprite sheets.
- Apply coordinate transformations (scaling, rotation, flipping) and manage context states using save and restore.
🔹 Lesson 9: Advanced Forms and Persistent Applications
Overview: This lesson explores advanced web development techniques, focusing on asynchronous communication via XMLHttpRequest and Promises, deep interaction with HTML form fields, and client-side data persistence. Students will learn to manage network requests with custom headers and handle errors in asynchronous flows by building a modular paint application and a persistent note-taking tool.
Learning Outcomes:
- Configure and execute asynchronous network requests using XMLHttpRequest and Promise-based chaining.
- Manipulate complex form behaviors, including focus management, field disabling, and file handling.
- Implement client-side data storage using localStorage and sessionStorage to maintain application state.
🔹 Lesson 10: Server-Side Development with Node.js
Overview: This lesson bridges the gap between advanced client-side interactivity and server-side logic. Students will first master complex canvas manipulation tools and browser security constraints before transitioning into the Node.js environment to build asynchronous file servers and real-time web applications using long-polling and RESTful routing.
Learning Outcomes:
- Implement advanced drawing tools (Line, Erase, Spray Paint, Flood Fill) and manage canvas security (Tainting).
- Execute server-side scripts using Node.js, managing dependencies via NPM and handling asynchronous I/O with callbacks and promises.
- Construct a functional HTTP server capable of file manipulation, JSON request processing, and real-time updates via long-polling.