Содержание
- 2. Agenda Custom objects Constructors Context and "this" Operator "new"
- 3. Custom Object
- 4. Object creation You know that we can create a simple object in JavaScript. We use JSON
- 5. Object or Hash Table But this way it looks like hash table creation. What is the
- 6. Object or Hash Table Typically we use hash table if we want to represent some collection,
- 7. Difference in use There are some differences in using of hash tables and objects as a
- 8. Constructors
- 9. Constructors Sometimes we need to create more than one single object. It is not a good
- 10. Constructors: example function Cat (name) { this.name = name; this.run = function () { console.log(this.name +
- 11. Context and "this"
- 12. Context Let's imagine two identical objects. They are created by Cat constructor: var murzyk = new
- 13. Context If we call method run() for both cats, we’ll take correct results: murzyk.run(); barzyk.run(); In
- 14. Context It works because we use the next form of access to attribute name: this.name. this
- 15. Loss of context Be careful! There are situations when you can lose a context. For example:
- 16. Operator new
- 17. Pre-example Imagine that some abstract factory produces cars. All cars are absolutely identical: [1]
- 18. Pre-example But there are some emergency services and each of them has an own color scheme
- 19. New: scenario of work new processing has a similar scenario: creation of default object calling of
- 20. New: example creation of default object var murzyk = new Cat("Murzyk"); var _temporary_ref = new Object();
- 21. New: example calling of constructor with just created object context var murzyk = new Cat("Murzyk"); _temporary_ref.Cat();
- 22. New: example modification of default object var murzyk = new Cat("Murzyk"); this.name = "Murzyk"; this.run =
- 23. New: example returning and saving the reference to modified object var murzyk = new Cat(“Murzyk”); var
- 25. Скачать презентацию















![Pre-example Imagine that some abstract factory produces cars. All cars are absolutely identical: [1]](/_ipx/f_webp&q_80&fit_contain&s_1440x1080/imagesDir/jpg/377517/slide-16.jpg)






Урок русского языка (развитие речи) 7 класс Учитель русского языка и литературы Бокова Лидия Александровна
РАССЛЕДОВАНИЕ ПРЕСТУПЛЕНИЙ В СФЕРЕ НАРКОБИЗНЕСА доцент И.В. Петров
С чего начать?
День Петра и Февронии 8 июля: день любви, семьи и верности
Выветривание, почвообразующие породы, минеральная часть почвы
Праздничное оформление улиц
Презентация на тему Сборник раскрасок-заданий
Плесень
Обязательное энергетическое обследование (энергоаудит) юридических лиц. Разработка энергетических паспортов 13 декабря 2011 г.
как не заразить посетителейсвоего сайта
Традиции Грузии
Оценочная деятельность на уроках английского языка в начальной школе
Организация услуг по ремонту обуви на выездном сервисе Nikko
Всё про воздух
Компиляторы. МУ по лабораторным работам
Национальная безопасность России
Федеральный закон №273 Об образовании
Баллада о влюбленном Павуке. Синопсис. Игра для одного человека
Эпоха Великих географических открытий
Отчет о ПК по программе «Технология организации единого развития компетентности преподавателя и студента»
Некоторые результаты испытания системы контроля подкритичности реактора на блоке №1 Ленинградской АС
Влияние арт-терапии на психоэмоциональное состояние учащихся
Молекулы
Жестокость и насилие в семьеМОБУ «СОШ №6» г.Всеволожска
Лазерные компоненты
Гидротехнические бетоны
С днем рождения (стихи и открытки)
Правописание жи-ши