Kyle wraps up his coverage on coercion with a some helpful resources. He also talks a through a few last surprises he has discovered during his research on coercion.
(flute techno music)…- This is a really neat, interesting visual tool.…I'd encourage you to kind of play around with this.…You remember there were several times…when I said, "It doesn't do this.…"Here's what it does."…and I gave you several steps.…This one becomes a string first,…and then a number, and so forth.…This is a visual tool that shows you those steps.…You can actually put in two different types of values…and then it shows you the steps so it's kind of…an interesting way of learning…how those coercion rules are applied.…
And this is also a really fantastic, long, and detailed post…blog post about many of the same details.…Andreas wrote that.…I still reference that…even though it comes from 2010, it still is relevant today.…Let's finish on a slightly lighter note,…let me just show you a couple of silly surprises…that can happen with coercion.…parseInt, the first line.…
parseInt with a string zero eight.…Some of you may have been bitten by this in the past.…I certainly have been bitten more than once…in my coding career because the original version of parseInt…
Note: This course was created by Frontend Masters. It was originally released on 8/29/2015. We're pleased to host this training in our library.
- Primitive types: undefined, string, number, boolean, and object
- Special values: NaN and negative zero
- Natives: Regex and date
- Functions: toString, toNumber, and toBoolean
- Implicit coercion
- Explicit coercion
- Strings, numbers, and booleans
- Operators: Double equal and triple equal