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
1
66
JavaScript Type Conversions
JavaScript Type Conversions and some explanations to the Gary Bernhardt's wat lighting talk
Orlando Del Aguila
March 13, 2015
Tweet
Share
More Decks by Orlando Del Aguila
See All by Orlando Del Aguila
Open Source + Nonprofits = 💪
orlando
0
95
Web APIs 2019
orlando
0
150
Managing remote teams
orlando
0
72
How to be a Senior Software Engineer
orlando
0
150
Terraform Workshop
orlando
1
170
Infrastructure as Code with Terraform
orlando
0
300
Concurrencia, Paralelismo y el Event-loop
orlando
0
370
Talking Web Apps
orlando
0
110
Web Launchpad - Chelajs
orlando
0
240
Other Decks in Programming
See All in Programming
Tinkerbellから学ぶ、Podで DHCPをリッスンする手法
tomokon
0
150
20251212 AI 時代的 Legacy Code 營救術 2025 WebConf
mouson
0
240
生成AIを利用するだけでなく、投資できる組織へ
pospome
2
430
QAフローを最適化し、品質水準を満たしながらリリースまでの期間を最短化する #RSGT2026
shibayu36
0
550
AIによるイベントストーミング図からのコード生成 / AI-powered code generation from Event Storming diagrams
nrslib
1
190
チームをチームにするEM
hitode909
0
430
実は歴史的なアップデートだと思う AWS Interconnect - multicloud
maroon1st
0
300
クラウドに依存しないS3を使った開発術
simesaba80
0
210
ゲームの物理 剛体編
fadis
0
390
Flutter On-device AI로 완성하는 오프라인 앱, 박제창 @DevFest INCHEON 2025
itsmedreamwalker
1
180
Basic Architectures
denyspoltorak
0
160
Pythonではじめるオープンデータ分析〜書籍の紹介と書籍で紹介しきれなかった事例の紹介〜
welliving
3
720
Featured
See All Featured
Leading Effective Engineering Teams in the AI Era
addyosmani
9
1.4k
Amusing Abliteration
ianozsvald
0
80
Leadership Guide Workshop - DevTernity 2021
reverentgeek
1
180
Exploring the relationship between traditional SERPs and Gen AI search
raygrieselhuber
PRO
2
3.5k
A designer walks into a library…
pauljervisheath
210
24k
Self-Hosted WebAssembly Runtime for Runtime-Neutral Checkpoint/Restore in Edge–Cloud Continuum
chikuwait
0
260
技術選定の審美眼(2025年版) / Understanding the Spiral of Technologies 2025 edition
twada
PRO
115
100k
Agile Actions for Facilitating Distributed Teams - ADO2019
mkilby
0
100
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
254
22k
Organizational Design Perspectives: An Ontology of Organizational Design Elements
kimpetersen
PRO
0
48
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
17k
コードの90%をAIが書く世界で何が待っているのか / What awaits us in a world where 90% of the code is written by AI
rkaga
58
41k
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