By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,290 Members | 1,195 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,290 IT Pros & Developers. It's quick & easy.

Prototype.js does not set objects's constructor property properly

P: n/a
create a class myClass using prototype.js's Class.create()
then create an object foo of that myClass
then "object.constructor" will return
"function Object() { [native code for Object.Object, arity=1] }"

should be myClass

does prototype.js does not set the constructor property properly

if i create the class using
function myClass(){};
foo = new myClass()
foo.constructor
will give
function myClass() {
}
Dec 5 '07 #1
Share this Question
Share on Google+
3 Replies


P: n/a
On Dec 5, 7:39 pm, "navneet....@gmail.com" <navneet....@gmail.com>
wrote:
create a class myClass using prototype.js's Class.create()
then create an object foo of that myClass
[...]

Questions specifically related to features or usage of particular
libraries are off-topic here, you should try a Prototype.js news
group, e.g.:

<URL: http://groups.google.com.au/group/ru...s?hl=en&lnk=li
>
<FAQENTRY>

Suggested new 2nd paragraph for FAQ #2.2 (updaated[1]):

If your question relates to a particular javascript library, or
conflicts between libraries, you should ask in a news group or forum
that supports the library. The clj news group will consider questions
realted to javascript within a library if no suitable answer is
provided on the library-specific forum. Make sure you include a link
to where you asked the question, or information on the responses you
received.

</FAQENTRY>

1. <URL:
http://groups.google.com.au/group/co...ca21cc1e264d8a
>
--
Rob
Dec 5 '07 #2

P: n/a
On Wed, 5 Dec 2007 at 01:39:37, in comp.lang.javascript,
na*********@gmail.com wrote:
>create a class myClass using prototype.js's Class.create()
then create an object foo of that myClass
then "object.constructor" will return
"function Object() { [native code for Object.Object, arity=1] }"

should be myClass
The ECMAScript standard does not require every object to have or inherit
a 'constructor' property. Don't be surprised if you get an unexpected
result. In this case it looks as though the prototype chain was created
by doing new Object(); , and not altered later on.

>does prototype.js does not set the constructor property properly

if i create the class using
function myClass(){};
foo = new myClass()
foo.constructor
will give
function myClass() {
}
You've forgotten to put quotes round the answer : it's the result of
calling toString on a function object.

John
--
John Harris
Dec 5 '07 #3

P: n/a
RobG wrote:
On Dec 5, 7:39 pm, "navneet....@gmail.com" <navneet....@gmail.com>
wrote:
>create a class myClass using prototype.js's Class.create()
then create an object foo of that myClass
[...]

Questions specifically related to features or usage of particular
libraries are off-topic here, you should try a Prototype.js news
group, e.g.:

<URL: http://groups.google.com.au/group/ru...s?hl=en&lnk=li
I seriously doubt this is a link to a *newsgroup*.
<FAQENTRY>

Suggested new 2nd paragraph for FAQ #2.2 (updaated[1]):

If your question relates to a particular javascript library, or
conflicts between libraries, you should ask in a news group or forum
that supports the library.
NAK. That should be reworded so that the potential disadvantage of using
the particular library can be pointed out here.
The clj news group will consider questions
realted to javascript within a library if no suitable answer is
provided on the library-specific forum.
Make sure you include a link to where you asked the question, or
information on the responses you received.
NAK. I am not going to search the Web or login to a Web forum to determine
whether or not the posting is to consider. Furthermore, it is not the
newsgroup that considers it, but the subscribers of the newsgroup. And it
should be reworded ("might") so that these people are not said to be
compelled to reply.
PointedEars
--
realism: HTML 4.01 Strict
evangelism: XHTML 1.0 Strict
madness: XHTML 1.1 as application/xhtml+xml
-- Bjoern Hoehrmann
Dec 6 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.