javascript run function
var Object = { Name:"John", LastName: "Doe", CallName: function() { return this.Name + " " + this.LastName; } } Object.CallName(); // Will return "John Doe"
Here is what the above code is Doing:
1. We create an object called Object.
2. We add a property called Name and assign it the value “John”.
3. We add a property called LastName and assign it the value “Doe”.
4. We add a method called CallName.
5. We call the method CallName.