Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 18 additions & 18 deletions ecma5/examples-4-function.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
var animal = {
canRun: true
},
Wolf = function(){
this.name = 'Волк';
},
Grey = function(){
this.color = 'Серый';
},
Black = function(){
this.color = 'Черный';
};
canRun: true
},
Wolf = function(){
this.name = 'Волк';
},
Grey = function(){
this.color = 'Серый';
},
Black = function(){
this.color = 'Черный';
};

Wolf.prototype = animal;

Expand All @@ -19,17 +19,17 @@ Grey.prototype = wolfy;
Black.prototype = wolfy;

var wolfyGray = new Grey(),
wolfyBlack = new Black();
wolfyBlack = new Black();
//------------------------------------------------------------------------------------------------
var wolfyPrototipe = Object.getPrototipeOf( wolfyGray ); //not a worked in IE8
var wolfyPrototype = Object.getPrototypeOf( wolfyGray ); //not a worked in IE8

wolfyPrototipe.name = 'Пёс';
wolfyPrototype.name = 'Пёс';

wolfyGray.hasOwnProperty('color'); // Проверяет является ли своство у обекта личным

//------------------------------------------------------------------------------------------------
var car = {
color:red
color:red
};

var newCar = Object.create( car );
Expand All @@ -38,11 +38,11 @@ console.log( newCar );


function inherit( proto ) {
function createObject(){};
function createObject(){};

createObject.prototype = ptoro;
createObject.prototype = ptoro;

return new createObject;
return new createObject;
}

var newCar2 = inherit( car );
Expand Down