Understanding Loose Equality In JavaScript

preview_player
Показать описание

0:00 - Introduction
0:49 - Implicit Coercion & Loose Equality
2:15 - The Spec And you
3:15 - The Abs Eq Stepper
6:50 - The Headscratcher
8:48 - Understanding ToPrimitive
12:08 - Throwing Errors
15:00 - Closure
Рекомендации по теме
Комментарии
Автор

nice to hear an actual voice actor explaining javascript ! love it <3

olddriver
Автор

Nice explanation and tool, quite useful.

Small suggestions for the tool -
1. Show internals of ToPrimitive maybe
2. Auto-scroll to current highlighted step
3. Run all steps, with few sec in between each. Good for lazily seeing all the steps without manual next-next.

bendtherules
Автор

Wow is all I can say! So... wait a minute... if we evaluate null == 0 it jumps to step 13, but that would mean that it tested all previous steps 1-12 before reaching 13 and returning false. This process, if done this way, surely must be quite slow for spitting out false. I guess some other "logical" way of doing it (instead of pure elimination until it reaches the last step) would be preferred? Something like... "null is loosely equal to only itself or undefined". Not sure how the JS engine internals actually do this, but if you ask me, churning through that 13-step recipe is .... well a recipe for disaster! The engine should have something more efficient implemented in real world and I bet that V8 or SpiderMonkey actually do something better under the hood than this .... recipe.

lorandhorvath
Автор

Strict for prod, abstract for ... fun ?

ffxim