File tree Expand file tree Collapse file tree 2 files changed +39
-0
lines changed Expand file tree Collapse file tree 2 files changed +39
-0
lines changed Original file line number Diff line number Diff line change 1+ <!DOCTYPE html>
2+ < html lang ="en ">
3+ < head >
4+ < meta charset ="UTF-8 ">
5+ < meta name ="viewport " content ="width=device-width, initial-scale=1.0 ">
6+ < title > Document</ title >
7+ </ head >
8+ < body >
9+ < script src ="src/prototype.js "> </ script >
10+ </ body >
11+ </ html >
Original file line number Diff line number Diff line change 1+ // This is simple way to create object.
2+ let firstObject = {
3+ propOne : "Property One" ,
4+ propTwo : 1 ,
5+ funcOne : function ( ) {
6+ console . log ( "This is function of firstObject." ) ;
7+ }
8+ }
9+
10+ // This is second way to create object.
11+ let secondObject = new Object ( {
12+ propOne : "Property Two" ,
13+ propTwo : 2 ,
14+ funcOne : function ( ) {
15+ console . log ( "This is function of secondObject." ) ;
16+ }
17+ } ) ;
18+
19+ // This is someFunc in Object prototype.
20+ Object . prototype . someFunc = function ( ) {
21+ console . log ( "This is function of prototype." ) ;
22+ }
23+
24+ // This is new object with prototype by firstObject.
25+ let cloneObject = Object . create ( firstObject ) ;
26+
27+ // This is new string.
28+ let someString = new String ( "Some text" ) ;
You can’t perform that action at this time.
0 commit comments