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
JavaScript Type Conversions
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Orlando Del Aguila
March 13, 2015
Programming
120
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
130
Web APIs 2019
orlando
0
180
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
340
Concurrencia, Paralelismo y el Event-loop
orlando
0
410
Talking Web Apps
orlando
0
150
Web Launchpad - Chelajs
orlando
0
260
Other Decks in Programming
See All in Programming
なぜCTOを降りてFDEを選んだのか?〜なぜプロダクト企業がFDEで顧客の現場に踏み込むのか〜
gonta
1
210
JAWS-UG 東京支部が始める、JAWS-UG支部コラボ / JAWS-UG lunchtime LT Collaboration
y0hgi
0
270
コードレビューのボトルネックを"する側"と"される側"の両面から解消する
yub0n
2
1.6k
dotNET_vulnclicker_intro.pdf
deka_morita
0
140
【加筆修正版】Laravel のアプリケーションをどこにデプロイするか #phpcon_ehime
akase244
0
150
Kotlinの15年とServer-Side Kotlin
n_takehata
1
150
JIS keyboard support in Omarchy
lef237
0
110
ソニーのクラウド共通基盤の変遷とAI時代の開発スタイルに合わせた進化 / The Journey of Sony’s Common Cloud Platform and Its Evolution for AI-Native Development
kenjiyoneyama
0
270
GemmaをJevのように使ってみる / Use Gemma like Jev
kishida
5
790
SalesForceを内製化!? ~ HR事業を支える顧客管理基盤のインフラを大公開 ~
oku053
0
180
AWS CDKのカスタムリソースでContinuum(旧Security Agent)を実装した話 | Implementing Continuum (formerly Security Agent) via AWS CDK Custom Resource
akihisaikeda
2
150
気持ちぃ〜角丸 Squircle
ryu1013
0
310
Featured
See All Featured
Bootstrapping a Software Product
garrettdimon
PRO
306
120k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
56
3.5k
Making the Leap to Tech Lead
cromwellryan
135
10k
Primal Persuasion: How to Engage the Brain for Learning That Lasts
tmiket
0
500
Chasing Engaging Ingredients in Design
codingconduct
0
360
Why Mistakes Are the Best Teachers: Turning Failure into a Pathway for Growth
auna
0
320
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
1.3k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
232
55k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
130k
Redefining SEO in the New Era of Traffic Generation
szymonslowik
1
480
Learning to Love Humans: Emotional Interface Design
aarron
275
41k
Color Theory Basics | Prateek | Gurzu
gurzu
1
490
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