This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const oldGetSet = { | |
_value: "Old", | |
getValue: function () { | |
return this._value; | |
}, | |
setValue: function (newValue) { | |
this._value = newValue; | |
} | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
obj = null; | |
newObj = null; | |
anotherNewObj = null; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var obj = { | |
text: 'Hello!' | |
}; | |
/* в переменной obj хранится ссылка на ячейку памяти, где записан наш объект */ | |
var newObj = obj; | |
/* | |
несмотря на оператор присвоения в newObj будет храниться не объект, | |
а ссылка на ячейку памяти, которую передал obj | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var increaseByTwo = function (value) { | |
/* увеличиваем свойство переданного объекта на 2 */ | |
value.number += 2; | |
/* возвращаем результат */ | |
return value; | |
}; | |
/* объявляем переменную со сложным значением - объектом */ | |
var obj = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var increaseByTwo = function (value) { | |
/* увеличиваем переданное значение на 2 */ | |
value += 2; | |
/* возвращаем результат */ | |
return value; | |
}; | |
/* объявляем переменную с простым значением - числом */ | |
var number = 2; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var WIZARD_NAMES = [ | |
'Иван', | |
'Хуан', | |
'Себастьян', | |
'Мария', | |
'Кристоф', | |
'Виктор', | |
'Юлия', | |
'Люпита', | |
'Вашингтон' |