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
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Orlando Del Aguila
March 13, 2015
Programming
1
67
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
98
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
310
Concurrencia, Paralelismo y el Event-loop
orlando
0
380
Talking Web Apps
orlando
0
120
Web Launchpad - Chelajs
orlando
0
240
Other Decks in Programming
See All in Programming
Amazon Bedrockを活用したRAGの品質管理パイプライン構築
tosuri13
4
260
Oxlint JS plugins
kazupon
1
840
Package Management Learnings from Homebrew
mikemcquaid
0
210
FOSDEM 2026: STUNMESH-go: Building P2P WireGuard Mesh Without Self-Hosted Infrastructure
tjjh89017
0
160
Architectural Extensions
denyspoltorak
0
280
Oxlintはいいぞ
yug1224
5
1.3k
プロダクトオーナーから見たSOC2 _SOC2ゆるミートアップ#2
kekekenta
0
200
CSC307 Lecture 04
javiergs
PRO
0
660
AI時代のキャリアプラン「技術の引力」からの脱出と「問い」へのいざない / tech-gravity
minodriven
20
7k
メルカリのリーダビリティチームが取り組む、AI時代のスケーラブルな品質文化
cloverrose
2
510
AI によるインシデント初動調査の自動化を行う AI インシデントコマンダーを作った話
azukiazusa1
1
700
なぜSQLはAIぽく見えるのか/why does SQL look AI like
florets1
0
450
Featured
See All Featured
Why You Should Never Use an ORM
jnunemaker
PRO
61
9.7k
Designing Experiences People Love
moore
144
24k
Art, The Web, and Tiny UX
lynnandtonic
304
21k
Technical Leadership for Architectural Decision Making
baasie
1
240
<Decoding/> the Language of Devs - We Love SEO 2024
nikkihalliwell
1
130
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
254
22k
The Mindset for Success: Future Career Progression
greggifford
PRO
0
230
Mind Mapping
helmedeiros
PRO
0
78
Ethics towards AI in product and experience design
skipperchong
2
190
From Legacy to Launchpad: Building Startup-Ready Communities
dugsong
0
140
A Soul's Torment
seathinner
5
2.2k
Beyond borders and beyond the search box: How to win the global "messy middle" with AI-driven SEO
davidcarrasco
1
49
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