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
130
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
92
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
270
Other Decks in Programming
See All in Programming
Engineering Biometric UX Across Android Versions | DroidKnights 2026
ryunen344
1
180
作れる、でも消せるか?──安全に「枯らして消す」機能削除術 / Drain, Then Delete
chobishiba
3
1.4k
graphql-ruby を Spinel で速くしようとした話
mtsmfm
0
140
AI時代のシニアエンジニアとは
yosuke_furukawa
PRO
14
11k
小さなアプリを作って公開するまで
onozaty
0
130
Goコンパイラを作ってGoをもっと理解する / Build a Go compiler to better understand Go
ikura_hamu
0
120
AWS CDKを理解するために公式の定義を深掘って解説してみる / Understanding AWS CDK by Digging into Its Official Definition
akihisaikeda
3
280
Kotlinize Is Not Just Converting to Kotlin
chigichan24
1
220
Lambda durable functionsでHuman in the Loopを楽に…楽に……
har1101
2
290
まずはコードより業務と向き合う:テーブル解体のためにPdMを呼んだ話
sakawe_ee
0
170
AI時代のFlutter品質設計 — アプリ品質を守るQuality Layers
omatty198
0
360
Event is what happens
moro
2
3.7k
Featured
See All Featured
Fireside Chat
paigeccino
43
4.1k
Mind Mapping
helmedeiros
1
430
The World Runs on Bad Software
bkeepers
PRO
72
12k
AI in Enterprises - Java and Open Source to the Rescue
ivargrimstad
0
1.6k
Designing Powerful Visuals for Engaging Learning
tmiket
1
650
Money Talks: Using Revenue to Get Sh*t Done
nikkihalliwell
0
550
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
2
680
How STYLIGHT went responsive
nonsquared
100
6.4k
The Straight Up "How To Draw Better" Workshop
denniskardys
239
140k
Visual Storytelling: How to be a Superhuman Communicator
reverentgeek
2
740
Navigating the Design Leadership Dip - Product Design Week Design Leaders+ Conference 2024
apolaine
2
510
Art, The Web, and Tiny UX
lynnandtonic
304
22k
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