Quantcast
Channel: JavaScriptMVC Forum
Viewing all articles
Browse latest Browse all 3491

Re : If observable = new can.Observe(foo); then Chrome shows that observable is a Constructor and can be confusing

$
0
0
I also thought of a simpler way to explain:

function Person() {}

var a = new Person();

// use a.__proto__.constructor or a.constructor
console.log(a.__proto__.constructor)   // => function Person() {}

so I can expect a to have the traits of a person.

but

var ob = new can.Observe({});

console.log(ob.__proto__.constructor)   // => function Constructor() { ... }

so if I suppose ob has the traits of a constructor, then it is totally wrong.  ob has the traits of an observable **object**.  It doesn't have any traits of a constructor.




Viewing all articles
Browse latest Browse all 3491

Trending Articles