# Prototypes and Object.create

**URL:** <https://forum.kirupa.com/t/prototypes-and-object-create/328827>\
**Category:** web dev\
**Created:** [June 21, 2012, 10:40am UTC](https://forum.kirupa.com/t/prototypes-and-object-create/328827 "2012-06-21T10:40:13Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jeancnicolas](https://avatars.discourse-cdn.com/v4/letter/j/7bcc69/32.png) [@jeancnicolas](https://forum.kirupa.com/u/jeancnicolas)\
**Post date:** [June 21, 2012, 10:40am UTC](https://forum.kirupa.com/t/prototypes-and-object-create/328827/1 "2012-06-21T10:40:13Z")

</div>

Am trying to summarise a way of working in javascript that seems best of worlds to me.  
I want to generate an object, use prototyping, and use object.create to do this with some level of basic security and inheritance.

Im here cos my attempt is failing. Can anyone grasp what im trying to do, and give any fixing helpers? Thanks … \>

```auto
var Person = {
	init: function(firstName,lastName){
		this.firstName = firstName;
		this.lastName = lastName;
	}
}
Person.prototype.getFullName = function(){
	return this.firstName + " " + this.lastName;
}
Person.prototype.greet = function(person){
	return "Hello, " + person.getFullName();	
}
var mark = Object.create(Person.init("mark","anderson")),
	phil = Object.create(Person.init("phil","dumphy"));
alert(mark.greet(phil));

```
