Created
October 8, 2012 02:04
-
-
Save bmakarand2009/3850361 to your computer and use it in GitHub Desktop.
Javascript Object Literal
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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