How it feels to learn JavaScript in 2016

Oriol _ oriol-bugzilla at hotmail.com
Sat Nov 25 14:15:35 UTC 2017


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20171125/39fc180d/attachment.html>


More information about the es-discuss mailing list