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
Desmistificando Herança e Protótipos no JS - Short
Search
Lucas Santos
June 04, 2020
Programming
1
150
Desmistificando Herança e Protótipos no JS - Short
Lucas Santos
June 04, 2020
Tweet
Share
More Decks by Lucas Santos
See All by Lucas Santos
The Hitchhiker's Guide for an Amazing API with TypeScript
khaosdoctor
0
80
Escalando globalmente com TypeScript e JavaScript na Klarna
khaosdoctor
0
180
The future of JavaScript
khaosdoctor
0
52
TypeScript tips that could save your life
khaosdoctor
0
170
É hora de falar sobre Deno
khaosdoctor
0
65
JS Software testing for beginners
khaosdoctor
0
59
Ambientes dinâmicos com GitHub Actions
khaosdoctor
0
36
The Dark Side of JavaScript
khaosdoctor
0
68
Integrating Containers Into JavaScript
khaosdoctor
0
54
Other Decks in Programming
See All in Programming
Formの複雑さに立ち向かう
bmthd
1
940
推しメソッドsource_locationのしくみを探る - はじめてRubyのコードを読んでみた
nobu09
2
340
仕様変更に耐えるための"今の"DRY原則を考える
mkmk884
9
3.2k
CDK開発におけるコーディング規約の運用
yamanashi_ren01
2
260
Honoのおもしろいミドルウェアをみてみよう
yusukebe
1
240
Rubyと自由とAIと
yotii23
6
1.8k
Datadog Workflow Automation で圧倒的価値提供
showwin
1
280
「個人開発マネタイズ大全」が教えてくれたこと
bani24884
1
270
GoとPHPのインターフェイスの違い
shimabox
2
210
PEPCは何を変えようとしていたのか
ken7253
3
290
PHPカンファレンス名古屋2025 タスク分解の試行錯誤〜レビュー負荷を下げるために〜
soichi
1
730
15分で学ぶDuckDBの可愛い使い方 DuckDBの最近の更新
notrogue
3
750
Featured
See All Featured
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
193
16k
Building Applications with DynamoDB
mza
93
6.2k
Making the Leap to Tech Lead
cromwellryan
133
9.1k
Building a Scalable Design System with Sketch
lauravandoore
461
33k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
134
33k
Keith and Marios Guide to Fast Websites
keithpitt
411
22k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
What's in a price? How to price your products and services
michaelherold
244
12k
How to train your dragon (web standard)
notwaldorf
91
5.9k
Building Flexible Design Systems
yeseniaperezcruz
328
38k
Code Reviewing Like a Champion
maltzj
521
39k
Building a Modern Day E-commerce SEO Strategy
aleyda
38
7.1k
Transcript
Desmistificando Herança e Prototypes no Javascript Sempre esteve lá, ninguém
sabia o porquê
$ whoami Lucas Santos /khaosdoctor @_staticvoid lsantos.me Cloud Advocate ludossan@microsoft.com
@khaosdoctor
trainingcenter.io 2018.abcdevelopers.org
O.O.P
Encapsulamento
None
None
Polimorfismo
None
Arrow functions não vão funcionar
????????
Herança
Herança nos dá isso
Herança nos dá isso De onde veio isso?
De onde as coisas vem?
Tipos originais De onde tudo aparece
Array()
Function()
Object()
String Number Object Array Func RegExp
None
Como elas funcionam?
None
__proto__
Nunca toque no __proto__
Object.Prototype Não. Não é a mesma coisa
Prototype é um objeto de propriedades
O famoso “new”
Instâncias
Instâncias
Instâncias
Instâncias
Instâncias
Herança! Mas não é qualquer herança...
Herança Prototípica
Herança Prototípica
Instâncias
Cadeias de protótipos Como eu sei o que eu quero?
Cadeias de protótipos
Cadeias de protótipos
Cadeias de protótipos
Cadeia de protótipos
Cadeia de protótipos
Cadeias de protótipos: a prática
O fim da cadeia
O fim da cadeia?
E o “extends”?
Extends
Extends
Extends: Exemplo
Extends
O que eu faço com isso?
1. Métodos globais
2. Overload
2. Overload - Os problemas
None
3. Performance
3. Performance .print
3. Performance
3. Performance
Referências - bit.ly/medium-prototypes - bit.ly/ecma-proto - mzl.la/mdn-proto - mzl.la/function-js -
mzl.la/extends-jsx - bit.ly/encapsulamento-js - bit.ly/polimorfismo-js - bit.ly/this-js - bit.ly/imasters-smoosh
/khaosdoctor @_staticvoid lsantos.me @khaosdoctor