You suggest a list of types of fixed size. The lack of exposition of
user-definable value types is a problem you mention.
Having a better typeof is not as useful as having a better instanceof.
This would be more valuable:
```js
isA(42, Number) === true // Doesn't work with instanceof
isA([1,3], Array) === true // Does work with instanceof
isA({one:1}, Object) === true // The distinction between array and
object was always weird with typeof
class Thing {}
isA(new Thing, Thing) === true
class SubThing {}
isA(new SubThing, Thing) === true // Detects subclassing / prototype
chain (which instanceof does not do)
```
JS needs Ruby's is_a?.
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss