Permalink
Browse files

Explain why numbers aren't numbers

  • Loading branch information...
1 parent b59becc commit 8dea7f837ec079d2470648c5942182b514b42e93 @attaboy attaboy committed Jun 16, 2010
Showing with 1 addition and 1 deletion.
  1. +1 −1 posts/2010-06-16-typeof-number-is-not-number.md
@@ -20,7 +20,7 @@ But what happens if we try to add a method for this to the Number prototype?
// returns false!
</code>
-Why? It turns out that when you add methods to Number, the type of the number inside the method becomes "object" rather than "number", but Math.floor returns a result of type "number". So the method can be fixed two ways.
+Why? It turns out that when you add methods to Number, the type of the number inside the method becomes "object" rather than "number", but Math.floor returns a result of type "number". So the method can be fixed two ways. If you use the === operator, the two values are no longer equal because they're different types.
Solution 1:

0 comments on commit 8dea7f8

Please sign in to comment.