Skip to content

Commit 1b8f12d

Browse files
authored
Merge pull request #10 from Exarchiasghost/master
Updated README.md on basics Prototype and Tuna as usually.
2 parents a9cf4d8 + 3412756 commit 1b8f12d

File tree

2 files changed

+61
-20
lines changed

2 files changed

+61
-20
lines changed

Basic_Concepts/Promise/README.md

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,7 @@
44

55
A Promise represents an operation that hasn't completed yet, but is expected in the future.
66

7-
# Course Documentation
8-
9-
(this for me to fill up with every element
10-
11-
that you use in lessons. syntax
12-
13-
explaination and links for more)
7+
# Course Documentation
148

159
## HTML
1610

Basic_Concepts/Prototype/README.md

Lines changed: 60 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,73 @@
11
![](http://i.imgur.com/BgUMUGU.png)
22

3-
# Prototype
4-
5-
This MD file serves as example/template.
3+
# Prototype
64

7-
It will be filled up soon.
5+
According to [W3schools](http://www.w3schools.com/js/js_object_prototypes.asp):
6+
Every JavaScript object has a prototype. The prototype is also an object.
7+
All JavaScript objects inherit their properties and methods from their prototype.
88

9-
(for Bucky to fill up)
109

1110

1211
# Course Documentation
12+
13+
14+
## Javascript prototypes
15+
16+
According to [W3schools](http://www.w3schools.com/js/js_object_prototypes.asp):
17+
**Every JavaScript object has a prototype. The prototype is also an object.**
18+
19+
Person.prototype.getName = function () {
20+
return this.firstName + " " + this.lastName;
21+
};
22+
23+
All JavaScript objects inherit the properties and methods from their prototype.
24+
Objects created using an object literal, or with new Object(), inherit from a prototype called Object.prototype.
25+
Objects created with new Date() inherit the Date.prototype.
26+
The Object.prototype is on the top of the prototype chain.
27+
All JavaScript objects (Date, Array, RegExp, Function, ....) inherit from the Object.prototype.
28+
29+
Person.prototype.getName = function () {
30+
return this.firstName + " " + this.lastName;
31+
};
32+
33+
var bucky = new Person('Bucky', 'Roberts');
34+
var emily = new Person('Emily', 'Jones');
35+
36+
console.log(bucky.getName());
37+
console.log(emily.getName());
38+
39+
## Objects
40+
41+
In our example for objects we used the following code:
42+
43+
44+
Person.prototype.getName = function () {
45+
return this.firstName + " " + this.lastName;
46+
};
47+
48+
var bucky = new Person('Bucky', 'Roberts');
49+
var emily = new Person('Emily', 'Jones');
50+
51+
52+
That is the typical syntax of javascripts object as well:
53+
54+
var objectname = {
55+
property1: "property1valueinstringformat",
56+
property2: property2valueinarithmeticformat
57+
};
58+
59+
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
60+
1361

14-
(this for me to fill up with every element
62+
{ property: valueofproperty };
1563

16-
that you use in lessons. syntax
64+
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.
1765

18-
explaination and links for more)
66+
- Read more about [Object Oriented
67+
Programming](https://en.wikipedia.org/wiki/Object-oriented_programming)
68+
- in Wikipedia Read more about [Javascript
69+
Objects](http://www.w3schools.com/js/js_objects.asp) in W3schools
1970

20-
## Element to explain
2171

22-
(for example console.log)
2372

24-
***Links***
25-
- Wikipedia
26-
- Anotherlink,com
73+
> Written with [StackEdit](https://stackedit.io/).

0 commit comments

Comments
 (0)