Q:

How a prototype property works in memory?

If prototype is shared between all instances, how a prototype property works?
function Foo() { 

}

Foo.prototype.property = 1;

var a = new Foo();
var b = new Foo();

a.property = 50;

console.log(b.property) // why this line shows 1?

If it's not shared, what's the difference between a prototype property and a constructor property in memory?
function Foo() { 

}

Foo.prototype.property = 1;

vs 
function Foo() {
     this.property = 1;
}    

Additional doubts:

How this two different ways works in memory? 
Which one uses more memory and why?
When I create a method in prototype it makes sense to me that it is shared between all instances, I think I'll have only one method loaded in memory, but I can't understand how a property works.

A:

function Foo() { 

}

// Hey, everybody, if anyone asks you about 'property'
// unless you have your own, use this one.
Foo.prototype.property = 1;

var a = new Foo();
var b = new Foo();

// Hey, you! You're special. You get your own property.
// This one covers the shared one.
a.property = 50;

// Hey you, B! You're using the shared one.
console.log(b.property) // why this line shows 1?

That is kind of the basic difference between 'prototype' and a local property.
If, on an object, you ask for a property that object doesn't have, it runs to its parent and ask "Hey!  Can I use yours?"  This goes all they  back to the root object.
For real fun, and a sure fire way to get your co-workers to hate you, set:
Object.prototype.something = true;

I'll be available everywhere and break all sorts of stuff.

// Everyone share this copy of property
function Foo() { 

}

Foo.prototype.property = 1;

// Hey everybody! You get your OWN copy of property! Ain't you special.
function Foo() {
     this.property = 1;
}    

