Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
The 'New' Keyword in JavaScript
Search
Chris Bateman
April 16, 2014
Programming
77
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
The 'New' Keyword in JavaScript
Chris Bateman
April 16, 2014
More Decks by Chris Bateman
See All by Chris Bateman
Web Audio API + AngularJS
chrisbateman
1
840
Other Decks in Programming
See All in Programming
When benchmarks go bad - what I learned from measuring performance wrong
hollycummins
0
220
Starting & Sustaining Code-Based E2E Testing for Non-Coding QA Teams( #jasstniigata )
teyamagu
PRO
1
1k
Simple Storage Service(S3) is not simple
iwatsukayura
0
290
半永久的に提供し続けられるプライベートクラウドを目指して ― 利用者の認知負荷を抑えるAPI抽象化とハードウェア世代交代の基盤設計
tomokon
0
500
ソニーのクラウド共通基盤の変遷とAI時代の開発スタイルに合わせた進化 / The Journey of Sony’s Common Cloud Platform and Its Evolution for AI-Native Development
kenjiyoneyama
0
270
Herb in Rails 8.2: Your ERB views, now HTML-aware @ Kaigi on Rails 2026, Tokyo, Japan
marcoroth
2
230
dotNET_vulnclicker_intro.pdf
deka_morita
0
140
外から家のPCの電源入れたい!をPHPで解決する
kawashimo0
1
130
ハーネス設計入門 〜 基礎知識の整理から実務へのステップアップ 〜
kinopeee
28
32k
contenteditable と日本語入力に向き合う
colorful12
0
200
APNsからLive Activityを開始する話
yumnumm
0
170
自サークルのIdPからログアウトできるようになるまで
taiseiue
1
140
Featured
See All Featured
How to Talk to Developers About Accessibility
jct
2
580
4 Signs Your Business is Dying
shpigford
187
23k
16th Malabo Montpellier Forum Presentation
akademiya2063
PRO
0
410
Mind Mapping
helmedeiros
1
400
Git: the NoSQL Database
bkeepers
PRO
433
67k
Tell your own story through comics
letsgokoyo
1
1.1k
WENDY [Excerpt]
tessaabrams
14
40k
What Being in a Rock Band Can Teach Us About Real World SEO
427marketing
0
1.1k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
4.6k
The Spectacular Lies of Maps
axbom
PRO
1
1.1k
Building the Perfect Custom Keyboard
takai
2
910
DevOps and Value Stream Thinking: Enabling flow, efficiency and business value
helenjbeal
2
410
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