Suche senden
Hochladen
OOP in JavaScript
âą
16 gefÀllt mir
âą
5,974 views
Eyal Vardi
Folgen
OOP in JavaScript
Weniger lesen
Mehr lesen
Technologie
Business
Melden
Teilen
Melden
Teilen
1 von 45
Empfohlen
Async & Parallel in JavaScript
Async & Parallel in JavaScript
Eyal Vardi
Â
Forms in AngularJS
Forms in AngularJS
Eyal Vardi
Â
Backbone testing
Backbone testing
Crashlytics
Â
PHPUnit ă§ăăăăăăčăăæžăăăă«
PHPUnit ă§ăăăăăăčăăæžăăăă«
Yuya Takeyama
Â
Min-Maxing Software Costs - Laracon EU 2015
Min-Maxing Software Costs - Laracon EU 2015
Konstantin Kudryashov
Â
Building Robust jQuery Plugins
Building Robust jQuery Plugins
Jörn Zaefferer
Â
Mocking Demystified
Mocking Demystified
Marcello Duarte
Â
Taming Command Bus
Taming Command Bus
Krzysztof MenĆŒyk
Â
Empfohlen
Async & Parallel in JavaScript
Async & Parallel in JavaScript
Eyal Vardi
Â
Forms in AngularJS
Forms in AngularJS
Eyal Vardi
Â
Backbone testing
Backbone testing
Crashlytics
Â
PHPUnit ă§ăăăăăăčăăæžăăăă«
PHPUnit ă§ăăăăăăčăăæžăăăă«
Yuya Takeyama
Â
Min-Maxing Software Costs - Laracon EU 2015
Min-Maxing Software Costs - Laracon EU 2015
Konstantin Kudryashov
Â
Building Robust jQuery Plugins
Building Robust jQuery Plugins
Jörn Zaefferer
Â
Mocking Demystified
Mocking Demystified
Marcello Duarte
Â
Taming Command Bus
Taming Command Bus
Krzysztof MenĆŒyk
Â
Be pragmatic, be SOLID (at Boiling Frogs, WrocĆaw)
Be pragmatic, be SOLID (at Boiling Frogs, WrocĆaw)
Krzysztof MenĆŒyk
Â
Be pragmatic, be SOLID
Be pragmatic, be SOLID
Krzysztof MenĆŒyk
Â
PhpSpec 2.0 ilustrated by examples
PhpSpec 2.0 ilustrated by examples
Marcello Duarte
Â
èłŒç©è»çšćŒæ¶æ§ç°Ąä»
èłŒç©è»çšćŒæ¶æ§ç°Ąä»
Jace Ju
Â
Min-Maxing Software Costs
Min-Maxing Software Costs
Konstantin Kudryashov
Â
How to test complex SaaS applications - The family july 2014
How to test complex SaaS applications - The family july 2014
Guillaume POTIER
Â
Geek Moot '09 -- Smarty 101
Geek Moot '09 -- Smarty 101
Ted Kulp
Â
Intro to Angular.JS Directives
Intro to Angular.JS Directives
Christian Lilley
Â
jQuery & 10,000 Global Functions: Working with Legacy JavaScript
jQuery & 10,000 Global Functions: Working with Legacy JavaScript
Guy Royse
Â
Functional Structures in PHP
Functional Structures in PHP
Marcello Duarte
Â
Moving a high traffic ZF1 Enterprise Application to SF2 - Lessons learned
Moving a high traffic ZF1 Enterprise Application to SF2 - Lessons learned
Baldur Rensch
Â
November Camp - Spec BDD with PHPSpec 2
November Camp - Spec BDD with PHPSpec 2
Kacper Gunia
Â
Angular Directives from Scratch
Angular Directives from Scratch
Christian Lilley
Â
CoffeeScript - A Rubyist's Love Affair
CoffeeScript - A Rubyist's Love Affair
Mark
Â
AngularJS Animations
AngularJS Animations
Eyal Vardi
Â
Forget about Index.php and build you applications around HTTP - PHPers Cracow
Forget about Index.php and build you applications around HTTP - PHPers Cracow
Kacper Gunia
Â
Advanced php testing in action
Advanced php testing in action
Jace Ju
Â
PHPSpec - the only Design Tool you need - 4Developers
PHPSpec - the only Design Tool you need - 4Developers
Kacper Gunia
Â
Asp.net mvc internals & extensibility
Asp.net mvc internals & extensibility
Eyal Vardi
Â
AngularJS $Provide Service
AngularJS $Provide Service
Eyal Vardi
Â
AngularJS Routing
AngularJS Routing
Eyal Vardi
Â
AngularJS - $http & $resource Services
AngularJS - $http & $resource Services
Eyal Vardi
Â
Weitere Àhnliche Inhalte
Was ist angesagt?
Be pragmatic, be SOLID (at Boiling Frogs, WrocĆaw)
Be pragmatic, be SOLID (at Boiling Frogs, WrocĆaw)
Krzysztof MenĆŒyk
Â
Be pragmatic, be SOLID
Be pragmatic, be SOLID
Krzysztof MenĆŒyk
Â
PhpSpec 2.0 ilustrated by examples
PhpSpec 2.0 ilustrated by examples
Marcello Duarte
Â
èłŒç©è»çšćŒæ¶æ§ç°Ąä»
èłŒç©è»çšćŒæ¶æ§ç°Ąä»
Jace Ju
Â
Min-Maxing Software Costs
Min-Maxing Software Costs
Konstantin Kudryashov
Â
How to test complex SaaS applications - The family july 2014
How to test complex SaaS applications - The family july 2014
Guillaume POTIER
Â
Geek Moot '09 -- Smarty 101
Geek Moot '09 -- Smarty 101
Ted Kulp
Â
Intro to Angular.JS Directives
Intro to Angular.JS Directives
Christian Lilley
Â
jQuery & 10,000 Global Functions: Working with Legacy JavaScript
jQuery & 10,000 Global Functions: Working with Legacy JavaScript
Guy Royse
Â
Functional Structures in PHP
Functional Structures in PHP
Marcello Duarte
Â
Moving a high traffic ZF1 Enterprise Application to SF2 - Lessons learned
Moving a high traffic ZF1 Enterprise Application to SF2 - Lessons learned
Baldur Rensch
Â
November Camp - Spec BDD with PHPSpec 2
November Camp - Spec BDD with PHPSpec 2
Kacper Gunia
Â
Angular Directives from Scratch
Angular Directives from Scratch
Christian Lilley
Â
CoffeeScript - A Rubyist's Love Affair
CoffeeScript - A Rubyist's Love Affair
Mark
Â
AngularJS Animations
AngularJS Animations
Eyal Vardi
Â
Forget about Index.php and build you applications around HTTP - PHPers Cracow
Forget about Index.php and build you applications around HTTP - PHPers Cracow
Kacper Gunia
Â
Advanced php testing in action
Advanced php testing in action
Jace Ju
Â
PHPSpec - the only Design Tool you need - 4Developers
PHPSpec - the only Design Tool you need - 4Developers
Kacper Gunia
Â
Asp.net mvc internals & extensibility
Asp.net mvc internals & extensibility
Eyal Vardi
Â
AngularJS $Provide Service
AngularJS $Provide Service
Eyal Vardi
Â
Was ist angesagt?
(20)
Be pragmatic, be SOLID (at Boiling Frogs, WrocĆaw)
Be pragmatic, be SOLID (at Boiling Frogs, WrocĆaw)
Â
Be pragmatic, be SOLID
Be pragmatic, be SOLID
Â
PhpSpec 2.0 ilustrated by examples
PhpSpec 2.0 ilustrated by examples
Â
èłŒç©è»çšćŒæ¶æ§ç°Ąä»
èłŒç©è»çšćŒæ¶æ§ç°Ąä»
Â
Min-Maxing Software Costs
Min-Maxing Software Costs
Â
How to test complex SaaS applications - The family july 2014
How to test complex SaaS applications - The family july 2014
Â
Geek Moot '09 -- Smarty 101
Geek Moot '09 -- Smarty 101
Â
Intro to Angular.JS Directives
Intro to Angular.JS Directives
Â
jQuery & 10,000 Global Functions: Working with Legacy JavaScript
jQuery & 10,000 Global Functions: Working with Legacy JavaScript
Â
Functional Structures in PHP
Functional Structures in PHP
Â
Moving a high traffic ZF1 Enterprise Application to SF2 - Lessons learned
Moving a high traffic ZF1 Enterprise Application to SF2 - Lessons learned
Â
November Camp - Spec BDD with PHPSpec 2
November Camp - Spec BDD with PHPSpec 2
Â
Angular Directives from Scratch
Angular Directives from Scratch
Â
CoffeeScript - A Rubyist's Love Affair
CoffeeScript - A Rubyist's Love Affair
Â
AngularJS Animations
AngularJS Animations
Â
Forget about Index.php and build you applications around HTTP - PHPers Cracow
Forget about Index.php and build you applications around HTTP - PHPers Cracow
Â
Advanced php testing in action
Advanced php testing in action
Â
PHPSpec - the only Design Tool you need - 4Developers
PHPSpec - the only Design Tool you need - 4Developers
Â
Asp.net mvc internals & extensibility
Asp.net mvc internals & extensibility
Â
AngularJS $Provide Service
AngularJS $Provide Service
Â
Andere mochten auch
AngularJS Routing
AngularJS Routing
Eyal Vardi
Â
AngularJS - $http & $resource Services
AngularJS - $http & $resource Services
Eyal Vardi
Â
AngularJS Compile Process
AngularJS Compile Process
Eyal Vardi
Â
AngulrJS Overview
AngulrJS Overview
Eyal Vardi
Â
AngularJS Testing
AngularJS Testing
Eyal Vardi
Â
AngularJS Directives
AngularJS Directives
Eyal Vardi
Â
AngularJS Architecture
AngularJS Architecture
Eyal Vardi
Â
Andere mochten auch
(7)
AngularJS Routing
AngularJS Routing
Â
AngularJS - $http & $resource Services
AngularJS - $http & $resource Services
Â
AngularJS Compile Process
AngularJS Compile Process
Â
AngulrJS Overview
AngulrJS Overview
Â
AngularJS Testing
AngularJS Testing
Â
AngularJS Directives
AngularJS Directives
Â
AngularJS Architecture
AngularJS Architecture
Â
Ăhnlich wie OOP in JavaScript
Objects & Classes in ECMAScript 6.0
Objects & Classes in ECMAScript 6.0
Eyal Vardi
Â
Whatâs new in ECMAScript 6.0
Whatâs new in ECMAScript 6.0
Eyal Vardi
Â
AMD & Require.js
AMD & Require.js
Eyal Vardi
Â
Node.js Event Emitter
Node.js Event Emitter
Eyal Vardi
Â
Iterators & Generators in ECMAScript 6.0
Iterators & Generators in ECMAScript 6.0
Eyal Vardi
Â
Async & Parallel in JavaScript
Async & Parallel in JavaScript
Eyal Vardi
Â
Js hacks
Js hacks
Nishchit Dhanani
Â
Say It With Javascript
Say It With Javascript
Giovanni Scerra â
Â
JSDay Italy - Backbone.js
JSDay Italy - Backbone.js
Pierre Spring
Â
JavaScript for PHP developers
JavaScript for PHP developers
Stoyan Stefanov
Â
JSGeneve - Backbone.js
JSGeneve - Backbone.js
Pierre Spring
Â
Triggers, actions & behaviors in XAML
Triggers, actions & behaviors in XAML
Eyal Vardi
Â
Jsphp 110312161301-phpapp02
Jsphp 110312161301-phpapp02
Seri Moth
Â
Fundamental JavaScript [UTC, March 2014]
Fundamental JavaScript [UTC, March 2014]
Aaron Gustafson
Â
So you think you know JavaScript
So you think you know JavaScript
Matt Apperson
Â
Proxies in ECMAScript 6.0
Proxies in ECMAScript 6.0
Eyal Vardi
Â
Web Optimization Summit: Coding for Performance
Web Optimization Summit: Coding for Performance
johndaviddalton
Â
Future of JavaScript
Future of JavaScript
Eyal Vardi
Â
Stuff you didn't know about action script
Stuff you didn't know about action script
Christophe Herreman
Â
Javascript tid-bits
Javascript tid-bits
David Atchley
Â
Ăhnlich wie OOP in JavaScript
(20)
Objects & Classes in ECMAScript 6.0
Objects & Classes in ECMAScript 6.0
Â
Whatâs new in ECMAScript 6.0
Whatâs new in ECMAScript 6.0
Â
AMD & Require.js
AMD & Require.js
Â
Node.js Event Emitter
Node.js Event Emitter
Â
Iterators & Generators in ECMAScript 6.0
Iterators & Generators in ECMAScript 6.0
Â
Async & Parallel in JavaScript
Async & Parallel in JavaScript
Â
Js hacks
Js hacks
Â
Say It With Javascript
Say It With Javascript
Â
JSDay Italy - Backbone.js
JSDay Italy - Backbone.js
Â
JavaScript for PHP developers
JavaScript for PHP developers
Â
JSGeneve - Backbone.js
JSGeneve - Backbone.js
Â
Triggers, actions & behaviors in XAML
Triggers, actions & behaviors in XAML
Â
Jsphp 110312161301-phpapp02
Jsphp 110312161301-phpapp02
Â
Fundamental JavaScript [UTC, March 2014]
Fundamental JavaScript [UTC, March 2014]
Â
So you think you know JavaScript
So you think you know JavaScript
Â
Proxies in ECMAScript 6.0
Proxies in ECMAScript 6.0
Â
Web Optimization Summit: Coding for Performance
Web Optimization Summit: Coding for Performance
Â
Future of JavaScript
Future of JavaScript
Â
Stuff you didn't know about action script
Stuff you didn't know about action script
Â
Javascript tid-bits
Javascript tid-bits
Â
Mehr von Eyal Vardi
Why magic
Why magic
Eyal Vardi
Â
Smart Contract
Smart Contract
Eyal Vardi
Â
Rachel's grandmother's recipes
Rachel's grandmother's recipes
Eyal Vardi
Â
Performance Optimization In Angular 2
Performance Optimization In Angular 2
Eyal Vardi
Â
Angular 2 Architecture (Bucharest 26/10/2016)
Angular 2 Architecture (Bucharest 26/10/2016)
Eyal Vardi
Â
Angular 2 NgModule
Angular 2 NgModule
Eyal Vardi
Â
Upgrading from Angular 1.x to Angular 2.x
Upgrading from Angular 1.x to Angular 2.x
Eyal Vardi
Â
Angular 2 - Ahead of-time Compilation
Angular 2 - Ahead of-time Compilation
Eyal Vardi
Â
Routing And Navigation
Routing And Navigation
Eyal Vardi
Â
Angular 2 Architecture
Angular 2 Architecture
Eyal Vardi
Â
Angular 1.x vs. Angular 2.x
Angular 1.x vs. Angular 2.x
Eyal Vardi
Â
Angular 2.0 Views
Angular 2.0 Views
Eyal Vardi
Â
Component lifecycle hooks in Angular 2.0
Component lifecycle hooks in Angular 2.0
Eyal Vardi
Â
Template syntax in Angular 2.0
Template syntax in Angular 2.0
Eyal Vardi
Â
Http Communication in Angular 2.0
Http Communication in Angular 2.0
Eyal Vardi
Â
Angular 2.0 Dependency injection
Angular 2.0 Dependency injection
Eyal Vardi
Â
Angular 2.0 Routing and Navigation
Angular 2.0 Routing and Navigation
Eyal Vardi
Â
Angular 2.0 Pipes
Angular 2.0 Pipes
Eyal Vardi
Â
Angular 2.0 forms
Angular 2.0 forms
Eyal Vardi
Â
Modules and injector
Modules and injector
Eyal Vardi
Â
Mehr von Eyal Vardi
(20)
Why magic
Why magic
Â
Smart Contract
Smart Contract
Â
Rachel's grandmother's recipes
Rachel's grandmother's recipes
Â
Performance Optimization In Angular 2
Performance Optimization In Angular 2
Â
Angular 2 Architecture (Bucharest 26/10/2016)
Angular 2 Architecture (Bucharest 26/10/2016)
Â
Angular 2 NgModule
Angular 2 NgModule
Â
Upgrading from Angular 1.x to Angular 2.x
Upgrading from Angular 1.x to Angular 2.x
Â
Angular 2 - Ahead of-time Compilation
Angular 2 - Ahead of-time Compilation
Â
Routing And Navigation
Routing And Navigation
Â
Angular 2 Architecture
Angular 2 Architecture
Â
Angular 1.x vs. Angular 2.x
Angular 1.x vs. Angular 2.x
Â
Angular 2.0 Views
Angular 2.0 Views
Â
Component lifecycle hooks in Angular 2.0
Component lifecycle hooks in Angular 2.0
Â
Template syntax in Angular 2.0
Template syntax in Angular 2.0
Â
Http Communication in Angular 2.0
Http Communication in Angular 2.0
Â
Angular 2.0 Dependency injection
Angular 2.0 Dependency injection
Â
Angular 2.0 Routing and Navigation
Angular 2.0 Routing and Navigation
Â
Angular 2.0 Pipes
Angular 2.0 Pipes
Â
Angular 2.0 forms
Angular 2.0 forms
Â
Modules and injector
Modules and injector
Â
KĂŒrzlich hochgeladen
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
apidays
Â
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
Remote DBA Services
Â
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
Michael W. Hawkins
Â
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
Gabriella Davis
Â
đŹ The future of MySQL is Postgres đ
đŹ The future of MySQL is Postgres đ
RTylerCroy
Â
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc
Â
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Miguel AraĂșjo
Â
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Neo4j
Â
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
Rafal Los
Â
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
The Digital Insurer
Â
presentation ICT roal in 21st century education
presentation ICT roal in 21st century education
jfdjdjcjdnsjd
Â
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
HampshireHUG
Â
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
Antenna Manufacturer Coco
Â
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
debabhi2
Â
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
The Digital Insurer
Â
Scaling API-first â The story of a global engineering organization
Scaling API-first â The story of a global engineering organization
Radu Cotescu
Â
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc
Â
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
Maria Levchenko
Â
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
wesley chun
Â
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
apidays
Â
KĂŒrzlich hochgeladen
(20)
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
Â
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
Â
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
Â
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
Â
đŹ The future of MySQL is Postgres đ
đŹ The future of MySQL is Postgres đ
Â
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
Â
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Â
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Â
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
Â
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Â
presentation ICT roal in 21st century education
presentation ICT roal in 21st century education
Â
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
Â
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
Â
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
Â
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
Â
Scaling API-first â The story of a global engineering organization
Scaling API-first â The story of a global engineering organization
Â
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
Â
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
Â
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
Â
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Â
OOP in JavaScript
1.
© 2013 E4D
LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
2.
http://www.expertdays.co.il © 2013 E4D
LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
3.
© 2013 E4D
LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
4.
© 2013 E4D
LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
5.
© 2013 E4D
LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
6.
var person =
{ name: "Nicholas" }; var person = {}; Object.defineProperty( person, "name", { configurable: true, enumerable: false, writable: false, value: "Michal" }); alert(person.name); //Michal person.name = "Eyal"; alert(person.name); //Michal © 2013 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
7.
var person =
{}; Object.defineProperty(person, "name", { configurable: false, value: "Michal" }); // Throws an error Object.defineProperty(person, "name", { configurable: true, value: "Michal" }); © 2013 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
8.
© 2013 E4D
LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
9.
var book =
{ _year: 2004, edition: 1 }; Object.defineProperty(book, "year", { get: function(){ return this._year; }, set: function(newValue){ if (newValue > 2004) { this._year = newValue; } } }); book.year = 2005; © 2013 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il __defineGetter__() and __defineSetter__() old version Prior to the ECMAScript 5.
10.
var book =
{}; Object.defineProperties(book, { // Data Properties _year: { value: 2004 }, edition: { value: 1 }, // Accessor Properties year: { get: function () { return this._year; }, set: function (newValue) { if (newValue > 2004) { this._year = newValue; this.edition += newValue - 2004; } } } }); © 2013 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
11.
var descriptor =
Object.getOwnPropertyDescriptor(book, "_year"); alert(descriptor.value); //2004 alert(descriptor.configurable); //false alert(typeof descriptor.get); //âundefi nedâ var descriptor = Object.getOwnPropertyDescriptor(book, "year"); alert(descriptor.value); //undefined alert(descriptor.enumerable); //false alert(typeof descriptor.get); //âfunctionâ © 2013 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
12.
© 2013 E4D
LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
13.
// makes it
impossible to add properties to obj. Example: var obj = { foo: 'a' }; Object.preventExtensions(obj); obj.bar = 'b'; // fails silently alert(obj.bar); // undefined // You can still delete properties, though. delete obj.foo; alert(obj.foo); // undefined // Checks whether obj is extensible: Object.isExtensible(obj); // false © 2013 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
14.
var obj =
{ foo: 'a' }; Object.getOwnPropertyDescriptor(obj, 'foo'); // before sealing // { value: 'a', writable: true, enumerable: true, configurable: true } Object.seal(obj); Object.getOwnPropertyDescriptor(obj, 'foo'); // after sealing // { value: 'a', writable: true, enumerable: true, configurable: false } // You can still change the property foo: obj.foo = 'b'; Object.isSealed(obj); // true © 2013 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
15.
var point =
{ x: 17, y: -5 }; Object.freeze(point); point.x = 2; // no effect, point.x is read-only //Checking whether an object is frozen Object.isFrozen(obj); // true © 2013 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
16.
© 2013 E4D
LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
17.
function Person(name, age,
job) { this.name = name; this.age = age; this.job = job; this.sayName = function () { alert(this.name); }; } var person1 = new Person("Dan", 29, "Software Engineer"); var person2 = new Person("Greg", 27, "Doctor"); © 2013 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
18.
alert(person1.constructor == Person);
//true alert(person2.constructor == Person); //true © 2013 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
19.
//use as a
constructor var person = new Person("Dan", 29, "Engineer"); person.sayName(); // "DaN" //call as a function Person("Greg", 27, "Doctor"); //adds to window window.sayName(); //"Greg" //call in the scope of another object var o = new Object(); Person.call(o, "Kristen", 25, "Nurse"); o.sayName(); //"Kristen" © 2013 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
20.
function var var this function this function var new © 2013 E4D
LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
21.
function Person(name, age,
job) { ... this.sayName = function () { alert(this.name); }; //logical equivalent this.sayName = new Function("alert(this.name)"); } alert(person1.sayName == person2.sayName); //false © 2013 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
22.
function Person(name, age,
job) { this.name = name; this.age = age; this.job = job; this.sayName = sayName; } function sayName() { alert(this.name); } © 2013 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
23.
function Cat(name, age,
job){ this.name = name; this.age = age; this.friends = ['A', 'B']; } Cat.prototype.sayName = function () { return this.name; } var myCat = new Cat('Mizi', 29); © 2013 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
24.
var friend =
new Person(); Person.prototype.sayHi = function(){ alert("hi"); }; friend.sayHi(); //"hi" - works! © 2013 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
25.
function Person(){ } var
friend = new Person(); // friend.__proto__ = Person.prototype Person.prototype constructor: name : age : job : sayName : }; = { Person, "Nicholas", 29, "Software Engineer", function () { alert(this.name); } friend.sayName(); // Error © 2013 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
26.
function Person(name, age,
job){ // properties this.name = name; this.age = age; this.job = job; // methods if (typeof this.sayName != "function"){ Person.prototype.sayName = function(){ alert(this.name); }; } } var friend = new Person('Nicholas', 29, 'Software Engineer'); friend.sayName(); © 2013 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
27.
© 2013 E4D
LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
28.
© 2013 E4D
LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
29.
SubType.prototype = SuperType.prototype function
SuperType() { this.val = true; } SuperType.prototype.getSuperValue = function () { return this.val; }; function SubType() { this.subVal = false; } //inherit from SuperType SubType.prototype = SuperType.prototype; val getSubValue subVal SubType.prototype.getSubValue = function () { return this.subVal; }; __proto__ var instance = new SubType(); // undefined ( this.val == undefined ) alert(instance.getSuperValue() ); © 2013 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il getSuperValue subVal
30.
SubType.prototype = new
SuperType(); function SuperType() { this.val = true; } SuperType.prototype.getSuperValue = function () { return this.val; }; function SubType() { this.subVal = false; } SubType.prototype = new SuperType(); SubType.prototype.getSubValue = function () { // new method return this.subVal; }; SubType.prototype.getSuperValue = function () {// override method return false; }; var instance = new SubType(); alert(instance.getSuperValue()); //false © 2013 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
31.
SubType.prototype = new
SuperType(); [prototype] getSuperValue val [prototype] subVal __proto__ val __proto__ subVal © 2013 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
32.
function SuperType(){ this.colors =
['red', 'blue', 'green']; } function SubType(){ } SubType.prototype = new SuperType(); var instance1 = new SubType(); instance1.colors.push('black'); alert(instance1.colors); //"red,blue,green,black" var instance2 = new SubType(); alert(instance2.colors); //"red,blue,green,black" © 2013 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
33.
function SuperType(){ this.colors =
['red', 'blue', 'green']; } function SubType(){ //inherit from SuperType SuperType.call(this); } SubType.prototype = new SuperType(); var instance1 = new SubType(); instance1.colors.push("black"); alert(instance1.colors); //"red,blue,green,black" var instance2 = new SubType(); alert(instance2.colors); © 2013 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il //"red,blue,green"
34.
function SuperType(name){ this.name =
name; } function SubType(){ //inherit from SuperType passing in an argument SuperType.call(this, "Nicholas"); //instance property this.age = 29; } SubType.prototype = new SuperType(); ... var instance = new SubType(); alert(instance.name); //"Nicholas"; alert(instance.age); //29 © 2013 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
35.
[prototype] getSuperValue val [prototype] subVal __proto__ val __proto__ val subVal © 2013 E4D
LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
36.
function create(o) { function
F() { } F.prototype = o; new F() return new F(); } © 2013 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il __proto__ o
37.
var person =
{ name: "Eyal", friends: ["Ran", "Dan"] }; var anotherPerson = Object(person); anotherPerson.name = "Greg"; anotherPerson.friends.push("Rob"); // Object.create(person); var yetAnotherPerson = Object(person); yetAnotherPerson.name = "Linda"; yetAnotherPerson.friends.push("Van"); alert(person.friends); © 2013 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il // "Ran, Dan, Rob, Van"
38.
function SuperType(name){ this.name =
name; this.colors = ['red', 'blue', 'green']; } SuperType.prototype.sayName = function(){ alert(this.name); }; function SubType(name, age){ SuperType.call(this, name); this.age = age; } SubType.prototype = Object.create(SuperType.prototype); SubType.prototype.sayAge = function(){ alert(this.age); }; © 2013 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
39.
[prototype] getSuperValue val [prototype] subVal __proto__ val subVal © 2013 E4D
LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il __proto__
40.
function SuperType(name){ this.name =
name; this.colors = ['red', 'blue', 'green']; } SuperType.prototype.sayName = function(){ return this.name; }; function SubType(name, age){ SuperType.call(this, name); this.age = age; } SubType.prototype = Object.create(SuperType.prototype); SubType.prototype.constructor = SubType; fix constructor SubType.prototype.sayAge = function(){ alert(this.age); }; override SubType.prototype.sayName = function(){ return SuperType.prototype.sayName.call(this) + "!!"; }; © 2013 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
41.
alert( person instanceof
Object ); alert( colors instanceof Array ); alert( pattern instanceof RegExp ); © 2013 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
42.
var instance =
new SubType(); alert(instance instanceof Object); //true alert(instance instanceof SuperType); //true alert(instance instanceof SubType); //true alert(Object.prototype.isPrototypeOf(instance)); //true alert(SuperType.prototype.isPrototypeOf(instance)); //true alert(SubType.prototype.isPrototypeOf(instance)); //true © 2013 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
43.
var toString =
Object.prototype.toString; toString.call(new Date); toString.call(new String); toString.call(Math); // [object Date] // [object String] // [object Math] toString.call(undefined); toString.call(null); // [object Undefined] // [object Null] © 2013 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
44.
http://eyalvardi.wordpress.com/resources/html-5course-resourses/javascript/ http://javascript.info/tutorial © 2013 E4D
LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
45.
eyalvardi.wordpress.com © 2013 E4D
LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il