How it feels to learn JavaScript in 2016

kai zhu kaizhu256 at gmail.com
Sat Nov 25 15:03:50 UTC 2017


i disagree.  you can write more maintainable and cleaner code with the
premise typeof's will never change again (and give a one-time pass for
symbols), instead of over-engineered paranoid code that it *may*
change again in the future.


On 11/25/17, Oriol _ <oriol-bugzilla at hotmail.com> wrote:
> It was kind of obvious that checking whether some value is an object by
> ensuring that it's not any of the existing primitives would stop working if
> a new primitive was added, which effectively happened with symbols. If some
> library used that, I think it is to blame. Instead, I would recommend
> something more simple and reliable like
>
>
> ```js
> function isObject(value) {
>   return Object(value) === value;
> }
> function isObject(value) {
>   return new function(){ return value } === value;
> }
> ```
>
> --Oriol
>


More information about the es-discuss mailing list