Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
The 'New' Keyword in JavaScript
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Chris Bateman
April 16, 2014
Programming
0
66
The 'New' Keyword in JavaScript
Chris Bateman
April 16, 2014
Tweet
Share
More Decks by Chris Bateman
See All by Chris Bateman
Web Audio API + AngularJS
chrisbateman
1
830
Other Decks in Programming
See All in Programming
AI Schema Enrichment for your Oracle AI Database
thatjeffsmith
0
270
CSC307 Lecture 05
javiergs
PRO
0
500
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
550
Patterns of Patterns
denyspoltorak
0
1.4k
AIによる開発の民主化を支える コンテキスト管理のこれまでとこれから
mulyu
3
240
Honoを使ったリモートMCPサーバでAIツールとの連携を加速させる!
tosuri13
1
180
Fluid Templating in TYPO3 14
s2b
0
130
Spinner 軸ズレ現象を調べたらレンダリング深淵に飲まれた #レバテックMeetup
bengo4com
1
230
16年目のピクシブ百科事典を支える最新の技術基盤 / The Modern Tech Stack Powering Pixiv Encyclopedia in its 16th Year
ahuglajbclajep
5
1k
組織で育むオブザーバビリティ
ryota_hnk
0
170
20260127_試行錯誤の結晶を1冊に。著者が解説 先輩データサイエンティストからの指南書 / author's_commentary_ds_instructions_guide
nash_efp
1
950
izumin5210のプロポーザルのネタ探し #tskaigi_msup
izumin5210
1
110
Featured
See All Featured
Redefining SEO in the New Era of Traffic Generation
szymonslowik
1
210
Impact Scores and Hybrid Strategies: The future of link building
tamaranovitovic
0
200
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
254
22k
Context Engineering - Making Every Token Count
addyosmani
9
650
Have SEOs Ruined the Internet? - User Awareness of SEO in 2025
akashhashmi
0
270
More Than Pixels: Becoming A User Experience Designer
marktimemedia
3
320
Evolving SEO for Evolving Search Engines
ryanjones
0
120
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
26
3.3k
Why Your Marketing Sucks and What You Can Do About It - Sophie Logan
marketingsoph
0
73
What's in a price? How to price your products and services
michaelherold
247
13k
AI Search: Implications for SEO and How to Move Forward - #ShenzhenSEOConference
aleyda
1
1.1k
Build The Right Thing And Hit Your Dates
maggiecrowley
38
3k
Transcript
None
None
None
None
var simpleObject = { a: 'a' }; { a: 'a'
} simpleObject.toString(); // um, where does this function come from?
None
var simpleObject = { a: 'a' }; { a: 'a',
__proto__: { ... toString: function, hasOwnProperty: function, ... } }
var Demo = function() { ... }; Demo.prototype.doSomething = function()
{ ... };
var Demo = function() { this.prop = 'text'; }; Demo.prototype.action
= function() { alert(this.prop); }; var myDemo = Demo(); myDemo; // undefined myDemo.action() // ERROR window.prop; // 'text'
var Demo = function() { this.prop = 'text'; }; Demo.prototype.action
= function() { alert(this.prop); }; var myDemo = Demo(); myDemo; // { prop:'a', action:function } window.prop; // undefined myDemo.action(); // alerts "text"
var Demo = function() { this.prop = 'text'; }; Demo.prototype.action
= function() { alert(this.prop); }; var myDemo = new Demo();
var Demo = function() { this.prop = 'text'; }; Demo.prototype.action
= function() { alert(this.prop); }; var myDemo = new Demo();
• • • • • • • •
Object.create(myProtoObject); var obj = Object.create(null); // returns { } obj.toString();
// ERROR
var Demo = function() { this.prop = 'text'; }; Demo.prototype.action
= function() { alert(this.prop); }; var myDemo = new Demo(); var Demo = { init: function() { this.prop = 'text'; }, action: function() { alert(this.prop); } }; var myDemo = Object.create(Demo); myDemo.init();
None