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
JavaScript Type Conversions
Search
Orlando Del Aguila
March 13, 2015
Programming
100
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
JavaScript Type Conversions
JavaScript Type Conversions and some explanations to the Gary Bernhardt's wat lighting talk
Orlando Del Aguila
March 13, 2015
More Decks by Orlando Del Aguila
See All by Orlando Del Aguila
Open Source + Nonprofits = 💪
orlando
0
120
Web APIs 2019
orlando
0
170
Managing remote teams
orlando
0
88
How to be a Senior Software Engineer
orlando
0
170
Terraform Workshop
orlando
1
190
Infrastructure as Code with Terraform
orlando
0
330
Concurrencia, Paralelismo y el Event-loop
orlando
0
410
Talking Web Apps
orlando
0
140
Web Launchpad - Chelajs
orlando
0
260
Other Decks in Programming
See All in Programming
リアルな遅延を測る仕様
kota_yata
1
140
typoなんかねぇよ
raspython3
0
660
iOS開発×AI駆動開発 〜最近使って便利だったスキルの話〜
nogu66
0
140
まずはプロンプトガイドを読もう、話はそれからだ
kiakiraki
1
260
AI に Inclusive UI を書かせよう — Design Rules Skill で Compose UI を作り直す
theoriatec2024
1
430
Go 1.27からのGODEBUG / Go 1.27 リリースパーティ #go127party
mazrean
0
300
ALB ログから Trace を気合で繋げる技術
fohte
7
860
高専キャリア LT 発表内容
crysta1221
6
5.5k
私のClaude Code活用法 (個人開発編) - PHPerKaigi mini #4(2026/08/24)
panda_program
1
210
kubernetes コンポーネント開発入門 / 新卒N年目の勉強会&交流会!〜〇〇への誘い〜 #n_study
mazrean
0
160
Go を使い始めて 2 ヶ月の学び / My first two months with Go
contour_gara
0
420
AI駆動開発にグラフDBを重ねてみた
satoshi256kbyte
2
720
Featured
See All Featured
The SEO Collaboration Effect
kristinabergwall1
1
550
GraphQLの誤解/rethinking-graphql
sonatard
75
12k
エンジニアに許された特別な時間の終わり
watany
108
250k
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
1
390
State of Search Keynote: SEO is Dead Long Live SEO
ryanjones
0
260
Google's AI Overviews - The New Search
badams
0
1.6k
技術選定の審美眼(2025年版) / Understanding the Spiral of Technologies 2025 edition
twada
PRO
120
120k
Discover your Explorer Soul
emna__ayadi
2
1.3k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
1.3k
How to train your dragon (web standard)
notwaldorf
97
6.8k
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
11
1k
Keith and Marios Guide to Fast Websites
keithpitt
413
23k
Transcript
JavaScript Type Conversions
JavaScript Primitives yes, js has primitives
1. undefined 2. null 3. number 4. string 5. boolean
1. undefined 2. null yep, is not an object 3.
number 4. string 5. boolean
JavaScript Binary Operators we are going to address only -
and +
On doubt check the spec
http://www.ecma-international.org/ecma-262/5.1/#sec-11.6.1 http://www.ecma-international.org/ecma-262/5.1/#sec-11.6.2
+ Operator
If lprim or rprim are strings, then concatenate lprim and
rprim and return the result
- Operator
ToNumber(lprim) - ToNumber(rprim)
Examples
var a, b; a = "bla"; b = "ble"; a
+ b; //=> "blable" a - b; //=> "NaN" a = "5"; b = "4"; a + b; //=> "54" a - b; //=> 1
var obj = { valueOf: function valueOf() { console.log("valueOf"); return
{}; // not a primitive }, toString: function toString() { console.log("toString"); return {}; // not a primitive } }; obj - 1; // valueOf // toString // error obj + 1; // valueOf // toString // error
var func = function () { console.log('exec'); return { valueOf:
function valueOf() { console.log("valueOf"); return {}; // not a primitive }, toString: function toString() { console.log("toString"); return {}; // not a primitive } }; }; func() + 1; // exec // valueOf // toString // error
{} + [] //=> +[] == 0 [] + {}
//=> '' + '[object Object]' == '[object Object]' [] - {} //=> 0 - NaN == NaN {} - [] //=> -[] == -0
None
WAT https://www.destroyallsoftware.com/talks/wat