English | Size: 1.74 GB (1,863,927,594 bytes )
Most people will cite coercion and the == operator as the black magic that should never show up in your programs. Not only is coercion much easier to learn and properly apply than youíve believed, but avoiding it is missing out on important clarifications in style and readability of your code.
Table of Contents
00:00 - 09:12 Introduction Kyle Simpson begins the course with a brief overview of what heíll be covering throughout the course. He mentions a number of open source projects he maintains and the book series he is currently writing.
- http://getify.me , http://youdontknowjs.com
01:03:21 - 01:06:42 Special Values: Quiz Kyle gives the audience a quick quiz to check their knowledge about special values.
01:31:19 - 01:42:10 ToNumber Just like the ToString function, the ToNumber function will convert one value to another. In this case, the conversion is to a number. While number conversions are fairly straight forward, Kyle covers some issues that can lead to larger pitfalls. He also drills a little deeper into how the toNumber coercion is performed behind the scenes.
01:42:11 - 01:46:11 ToBoolean When determining if something is false, the ToBoolean function references a list of ďfalsyĒ values. If the object in question is on that list, the result is false. If it isnít on the list, the result is true. K
Implicit vs. Explicit Coercion
01:46:12 - 01:59:20 Explicit Coercion: Strings & Numbers Explicit coercion happens when itís obvious from the code that one type is being converted to another. Kyle shares a few code examples demonstrating ways to explicitly coerce values from String to Numbers and vice versa .
01:59:21 - 02:11:47 Explicit Coercion: Booleans While using the Boolean() native function is Kyleís preference, many developers will use a double negate (!!) to perform Boolean coercion. Kyle explains how this works and demonstrates a few other types of explicit coercion.
02:11:48 - 02:19:47 Implicit Coercion: Strings & Numbers Kyle defines implicit coercion as a side effect of some other operation. In other words, itís not clear when looking at the code that coercion will occur. Kyle introduces implicit coercion with a few examples using String and Number values.
02:19:48 - 02:28:55 Implicit Coercion: Booleans I most cases, Boolean implicit coercion occurs when performing conditional logic. For example, using a Number or String variable inside an if statement. Kyle talks about Boolean implicit coercion and warns the audience about using a double-equal operator in a boolean comparison.
02:28:56 - 02:34:22 Double-Equal Issues As Kyle mentioned earlier, using a double-equal operator in a Boolean comparison can lead to issues. In some cases a Boolean conversion will occur. In other cases it will not. These inconsistencies are why Kyle recommends avoiding this usage.
02:34:23 - 02:46:02 Implicit Coercion: The Bad Parts Kyle walks through the worst possible offenders with implicit coercion. These are the cases where the result of the coercion is completely unexpected. He leaves the audience with a few practical takeaways and best practices.
02:46:03 - 02:49:31 Implicit Coercion: The Safe Parts While many developers believe implicit coercion to be evil, Kyle shares the opposite view. He gives a number of examples why it can be beneficial and leads to simplified code.
02:49:32 - 02:57:59 Double vs. Triple Equal The double-equal operator allows coercion in a comparison. The triple equal operator does not. Kyle walks through number of example demonstrating how the result of these two operators can differ.
02:58:00 - 03:11:07 Helpful Implicit Coercion Using the double-equal operator can be helpful. Kyle shares some pro-tips about how to determine when this operator should be use. He also talks about the performance impacts of coercion.
03:11:08 - 03:20:48 Coercion Resources & Surprises 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.
Buy Long-term Premium Accounts To Support Me & Max Speed
If any links die or problem unrar, send request to http://goo.gl/aUHSZc