From 16710f3d51d1c3bf1a82656c9af6a577a0b66572 Mon Sep 17 00:00:00 2001 From: Exarchiasghost Date: Tue, 19 Jul 2016 12:25:56 +0200 Subject: [PATCH 1/2] Deletion of something that i forgot to delete. Very trivial edit. --- Basic_Concepts/Promise/README.md | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/Basic_Concepts/Promise/README.md b/Basic_Concepts/Promise/README.md index 5c9616c..a3e5063 100644 --- a/Basic_Concepts/Promise/README.md +++ b/Basic_Concepts/Promise/README.md @@ -4,13 +4,7 @@ A Promise represents an operation that hasn't completed yet, but is expected in the future. -# Course Documentation - -(this for me to fill up with every element - -that you use in lessons. syntax - -explaination and links for more) +# Course Documentation ## HTML From 3412756d0f525bfdb07a3a3403f649ef629daf1c Mon Sep 17 00:00:00 2001 From: Exarchiasghost Date: Tue, 19 Jul 2016 12:48:31 +0200 Subject: [PATCH 2/2] Update the Basics Prototype README.md On this one i had more references to the w3schools infos instead of explainations from myself. I am not an expert on the field and i wanted to be careful. Edits are more than welcome. --- Basic_Concepts/Prototype/README.md | 73 ++++++++++++++++++++++++------ 1 file changed, 60 insertions(+), 13 deletions(-) diff --git a/Basic_Concepts/Prototype/README.md b/Basic_Concepts/Prototype/README.md index 423b6b8..22d93ed 100644 --- a/Basic_Concepts/Prototype/README.md +++ b/Basic_Concepts/Prototype/README.md @@ -1,26 +1,73 @@ ![](http://i.imgur.com/BgUMUGU.png) -# Prototype - -This MD file serves as example/template. +# Prototype -It will be filled up soon. +According to [W3schools](http://www.w3schools.com/js/js_object_prototypes.asp): +Every JavaScript object has a prototype. The prototype is also an object. +All JavaScript objects inherit their properties and methods from their prototype. -(for Bucky to fill up) # Course Documentation + + +## Javascript prototypes + +According to [W3schools](http://www.w3schools.com/js/js_object_prototypes.asp): +**Every JavaScript object has a prototype. The prototype is also an object.** + + Person.prototype.getName = function () { + return this.firstName + " " + this.lastName; + }; + +All JavaScript objects inherit the properties and methods from their prototype. +Objects created using an object literal, or with new Object(), inherit from a prototype called Object.prototype. +Objects created with new Date() inherit the Date.prototype. +The Object.prototype is on the top of the prototype chain. +All JavaScript objects (Date, Array, RegExp, Function, ....) inherit from the Object.prototype. + + Person.prototype.getName = function () { + return this.firstName + " " + this.lastName; + }; + + var bucky = new Person('Bucky', 'Roberts'); + var emily = new Person('Emily', 'Jones'); + + console.log(bucky.getName()); + console.log(emily.getName()); + +## Objects + +In our example for objects we used the following code: + + + Person.prototype.getName = function () { + return this.firstName + " " + this.lastName; + }; + + var bucky = new Person('Bucky', 'Roberts'); + var emily = new Person('Emily', 'Jones'); + + + That is the typical syntax of javascripts object as well: + + var objectname = { + property1: "property1valueinstringformat", + property2: property2valueinarithmeticformat + }; + +We achieve to insert more values in one variable by turning it to an object and by use the "property" format to each of our value + -(this for me to fill up with every element + { property: valueofproperty }; -that you use in lessons. syntax + Curley brackets are defining the are of the properties, and also they defining that our variable is an object, and we separate our properties with the comma symbol. -explaination and links for more) + - Read more about [Object Oriented + Programming](https://en.wikipedia.org/wiki/Object-oriented_programming) + - in Wikipedia Read more about [Javascript + Objects](http://www.w3schools.com/js/js_objects.asp) in W3schools -## Element to explain -(for example console.log) -***Links*** - - Wikipedia - - Anotherlink,com \ No newline at end of file +> Written with [StackEdit](https://stackedit.io/).