Skip to content

Instantly share code, notes, and snippets.

@bmakarand2009
Created October 8, 2012 02:04
Show Gist options
  • Save bmakarand2009/3850361 to your computer and use it in GitHub Desktop.
Save bmakarand2009/3850361 to your computer and use it in GitHub Desktop.
Javascript Object Literal
//http://jsfiddle.net/mbhatamb/4JYQH/
//Below is the Description of Employee Object, in a simple way
Employee e = new Object();
e.firstName = "John";
e.lastName = "tester";
e.getFullName = new function() {
return this.firstName + " " + this.lastName;
}
console.log(e.getFullName());
//Below is the creation of a Employe Object, in Object literal Notation
Employee e1 = {
firstName : "john",
lastName : "tester",
getFullName : new function() {
return this.firstName + " " + this.lastName;
}
console.log(e1.getFullName());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment