-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathprototype.js
More file actions
28 lines (24 loc) · 710 Bytes
/
Copy pathprototype.js
File metadata and controls
28 lines (24 loc) · 710 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// This is simple way to create object.
let firstObject = {
propOne: "Property One",
propTwo: 1,
funcOne: function() {
console.log("This is function of firstObject.");
}
}
// This is second way to create object.
let secondObject = new Object({
propOne: "Property Two",
propTwo: 2,
funcOne: function() {
console.log("This is function of secondObject.");
}
});
// This is someFunc in Object prototype.
Object.prototype.someFunc = function() {
console.log("This is function of prototype.");
}
// This is new object with prototype by firstObject.
let cloneObject = Object.create(firstObject);
// This is new string.
let someString = new String("Some text");