E
EME
typeof new RegExp
EME said:typeof new RegExp
typeof new RegExp
Note that IE doesn't do that, it returns 'object' for functions.
I hope you meant: "it returns 'object' for host functions".
for furthur more,i have detail test below:
typeof new RegExp //result 'function' in Firefox, 'object' in IE6
new RegExp instanceof Function //result false in Firefox
David said:It isn't an instance of Function (it is an instance of RegExp.)
It isn't an instance of anything, as that would imply class-based inheritance.
David said:You are kidding right?
The operator quoted above that sentence should explain why I used that terminology.
I am not.
The operator above was borrowed from Java, a programming language that
uses only class-based inheritance, to ease programming in JavaScript for
developers that a familiar with Java. However, `instanceof' is only a
name, not a hint regarding the underlying concept of the operation in
implementations of Edition 3 of the ECMAScript Language Specification.
It is therefore inappropriate to speak of objects as instances of their
constructors.
On Dec 8, 9:15 am, Thomas 'PointedEars' Lahn <[email protected]> [...]It is therefore inappropriate to speak of objects as instances of their
constructors.
Thanks for that.
It isn't an instance of anything, as that would imply class-based inheritance.
RobG said:On Dec 8, 9:15 am, Thomas 'PointedEars' Lahn wrote: [...]It is therefore inappropriate to speak of objects as
instances of their constructors.
Thanks for that.
Maybe the instanceof operator should be "constructedby"?![]()
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.