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
Oxlintはいいぞ
yug1224
5
1.3k
Amazon Bedrockを活用したRAGの品質管理パイプライン構築
tosuri13
4
260
AI時代の認知負荷との向き合い方
optfit
0
150
プロダクトオーナーから見たSOC2 _SOC2ゆるミートアップ#2
kekekenta
0
200
今こそ知るべき耐量子計算機暗号(PQC)入門 / PQC: What You Need to Know Now
mackey0225
3
370
Implementation Patterns
denyspoltorak
0
280
Kotlin Multiplatform Meetup - Compose Multiplatform 외부 의존성 아키텍처 설계부터 운영까지
wisemuji
0
190
20260127_試行錯誤の結晶を1冊に。著者が解説 先輩データサイエンティストからの指南書 / author's_commentary_ds_instructions_guide
nash_efp
1
940
CSC307 Lecture 02
javiergs
PRO
1
770
SourceGeneratorのススメ
htkym
0
190
それ、本当に安全? ファイルアップロードで見落としがちなセキュリティリスクと対策
penpeen
7
2.4k
Basic Architectures
denyspoltorak
0
660
Featured
See All Featured
Abbi's Birthday
coloredviolet
1
4.7k
Max Prin - Stacking Signals: How International SEO Comes Together (And Falls Apart)
techseoconnect
PRO
0
84
Marketing Yourself as an Engineer | Alaka | Gurzu
gurzu
0
130
Building Experiences: Design Systems, User Experience, and Full Site Editing
marktimemedia
0
410
Ethics towards AI in product and experience design
skipperchong
2
190
Fireside Chat
paigeccino
41
3.8k
What's in a price? How to price your products and services
michaelherold
247
13k
The World Runs on Bad Software
bkeepers
PRO
72
12k
Art, The Web, and Tiny UX
lynnandtonic
304
21k
Why Our Code Smells
bkeepers
PRO
340
58k
The Hidden Cost of Media on the Web [PixelPalooza 2025]
tammyeverts
2
180
Crafting Experiences
bethany
1
48
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