tag:blogger.com,1999:blog-34454975.post6025821872411414816..comments2023-06-28T16:58:41.189+02:00Comments on Web Reflection: JavaScript constructor (did you know?)Andrea Giammarchihttp://www.blogger.com/profile/16277820774810688474noreply@blogger.comBlogger5125tag:blogger.com,1999:blog-34454975.post-15467387298826017092011-10-04T18:07:54.639+02:002011-10-04T18:07:54.639+02:00in 2007 things were slightly different I guess ......in 2007 things were slightly different I guess ...Andrea Giammarchihttps://www.blogger.com/profile/16277820774810688474noreply@blogger.comtag:blogger.com,1999:blog-34454975.post-20909527858623988432011-10-04T18:02:42.808+02:002011-10-04T18:02:42.808+02:00// Firefox 7.0.1
function Car() {};
var car = ne...// Firefox 7.0.1<br /><br />function Car() {};<br /><br />var car = new Car;<br /><br />console.log(car.constructor); // Car()<br /><br />car.constructor = Array;<br /><br />console.log(car.constructor); // [ undefined ]Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-34454975.post-31286561843505896312010-06-03T20:03:06.276+02:002010-06-03T20:03:06.276+02:00constructor is *not* read only EODconstructor is *not* read only EODAndrea Giammarchihttps://www.blogger.com/profile/16277820774810688474noreply@blogger.comtag:blogger.com,1999:blog-34454975.post-77883837738675335332010-06-03T04:05:41.023+02:002010-06-03T04:05:41.023+02:00I am wondering where you executed your code. I jus...I am wondering where you executed your code. I just checked in IE7, it seems to me constructor is read-only.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-34454975.post-34434173239420906002009-02-19T02:56:00.000+01:002009-02-19T02:56:00.000+01:00I'm more of a noob at JS than you. Can you tell me...I'm more of a noob at JS than you. Can you tell me what a constructor is and does? Why is it used...is it important in programming.<BR/><BR/>Yeah...re: you're first post of above about changing values with the same object, a loosely typed language is very handy in JS.Anonymousnoreply@blogger.com