Summary of "За что ненавидят Javascript?"
Overview
The video discusses common frustrations and peculiarities of JavaScript from the perspective of an experienced developer. It highlights several core technological concepts, product features, and challenges encountered in JavaScript development.
Key Technological Concepts and Issues in JavaScript
1. Data Types and Number Handling
- JavaScript uses a single number type: double-precision floating-point, which causes common rounding errors (e.g.,
0.1 + 0.2does not equal exactly0.3). - Special constants like
NaN(Not-a-Number) exist; although of type number, they represent invalid numbers and require special functions to detect. - The introduction of a new data type,
BigInt, aims to address some numeric precision issues but lacks full browser support.
2. Objects and Mutation
- Objects are fundamental in JavaScript, but their mutability can cause issues, especially when passed by reference to functions, leading to unintended side effects.
- Copying objects to avoid mutation is expensive and cumbersome.
- Almost everything in JavaScript is an object, including arrays, dates, regular expressions, and wrapper objects for primitives like Boolean and String.
- Identifying types requires special functions such as
Array.isArray().
3. Prototypes and Inheritance
- JavaScript is prototype-based rather than class-based, which can be confusing.
- Modifying prototypes can break existing code or libraries, leading to fragile codebases.
- Classes were introduced as syntactic sugar over prototypes but do not change the underlying prototype-based inheritance.
- Deep inheritance chains can slow down performance due to multiple prototype lookups.
4. Asynchronous JavaScript and Callbacks
- JavaScript is single-threaded; asynchronous behavior is implemented via the event loop/reactor pattern.
- Callbacks can lead to “callback hell,” making code hard to read and maintain.
- Promises and
async/awaitsyntax improve readability but introduce subtle behavioral differences (e.g., sequential vs. parallel execution of async functions) that can confuse beginners.
5. Platform Control and Browser Environment
- Developers have limited control over the client environment, including hardware, browser extensions, and security policies.
- Browser updates and tightening security can break existing sites, requiring rewrites or workarounds.
6. JavaScript Transpilation and Babel
- Slow language evolution and inconsistent browser support led to tools like Babel, which transpile modern JavaScript into older versions for compatibility.
- Babel is widely used in production, but reliance on it creates complexity and dependency issues (e.g., difficulty upgrading Babel without rewriting code).
- This raises questions about the value of writing “pure” JavaScript versus using languages or dialects that compile to JavaScript.
7. Node.js and Legacy Code Issues
- Some developers avoid upgrading Node.js versions, causing security vulnerabilities and incompatibility with modern libraries.
- This conservatism contributes to fragmentation and technical debt in JavaScript ecosystems.
8. Modules in JavaScript
- Originally, JavaScript lacked a native module system, leading to global namespace pollution.
- Node.js introduced
require()andmodule.exportsas a module system, which is limited and hard to statically analyze. - ES6 introduced
import/exportsyntax, but coexistence of both systems complicates tooling and interoperability. - Babel can convert between module systems, but this adds complexity.
- New proposals like the
.mjsextension aim to clarify module usage.
Product Features, Reviews, and Tutorials Mentioned
- Recommended Resource: The speaker references a detailed article on JavaScript number implementation and encourages deep exploration of the language via a linked website.
- Workshop Promotion: Glow Academy offers a free 4-day workshop to build a Kinopoisk-like web app using pure JavaScript, covering AJAX, promises, fetch API, and asynchronous programming.
- Tutorial Format: Online lessons with homework, focusing on practical application and understanding core JavaScript concepts.
Main Speakers and Sources
- The primary speaker is an experienced JavaScript developer sharing personal insights and critiques of the language.
- Glow Academy is mentioned as the organizer of the free JavaScript workshop.
Summary
The video provides an in-depth critique of JavaScript’s quirks and complexities, focusing on:
- Data types and numeric precision issues
- Object mutability and reference behavior
- Prototype-based inheritance and its pitfalls
- Challenges in asynchronous programming
- Limitations imposed by the browser environment
- Reliance on transpilers like Babel and associated complexities
- Fragmentation in module systems and ecosystem technical debt
Additionally, it promotes a practical workshop aimed at learning JavaScript through building a real-world web application.
Category
Technology
Share this summary
Featured Products
JavaScript from Beginner to Professional: Learn JavaScript quickly by building fun, interactive, and dynamic web apps, games, and pages
Learn JavaScript Quickly: A Complete Beginner’s Guide to Learning JavaScript, Even If You’re New to Programming (Crash Course with Hands-On Project, Book 5)
BabelJS For Beginners: Understanding JavaScript Transpilation with BabelJS for Aspiring Developers
Node.js for Beginners: A comprehensive guide to building efficient, full-featured web applications with Node.js
JavaScript Async: Events, Callbacks, Promises and Async Await