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
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
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
MySQLとPostgreSQLって何が違うの?
akagami
PRO
0
170
FastAPI の並行処理モデルを完全に理解する
hoto17296
9
3.8k
Swift愛好会100回記念 第1回を振り返る
jollyjoester
0
120
AWS Step Functions 大規模並列の壁を越える / jaws-sonic-2026-niigata-step-functions
kasacchiful
PRO
0
370
変化を抱擁するドキュメントの作り方 - ビジネスルール駆動開発がもたらす、コードとの新しい関係
ioki
2
110
Oxlintはいいぞ(続)
yug1224
1
550
Hello, Hiroshima Geospatial Data! — Exploring DoboX with Python
ra0kley
0
170
AI駆動開発にグラフDBを重ねてみた
satoshi256kbyte
2
740
go-spidermonkeyでAIエージェントのCode Modeを実装する
syumai
3
1.5k
不幸な GC
chencmd
0
880
コンパウンドプロダクト開発のためのローカルプロセスマネージャー再発明 #layerxgo
izumin5210
0
640
Building an Out-of-Order CPU
latte72
0
690
Featured
See All Featured
Odyssey Design
rkendrick25
PRO
2
800
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
56
3.5k
Making Projects Easy
brettharned
120
6.7k
AI in Enterprises - Java and Open Source to the Rescue
ivargrimstad
0
1.5k
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
330
Everyday Curiosity
cassininazir
0
310
First, design no harm
axbom
PRO
2
1.3k
Information Architects: The Missing Link in Design Systems
soysaucechin
1
1.1k
StorybookのUI Testing Handbookを読んだ
zakiyama
31
6.9k
Principles of Awesome APIs and How to Build Them.
keavy
128
18k
sira's awesome portfolio website redesign presentation
elsirapls
0
400
Getting science done with accelerated Python computing platforms
jacobtomlinson
2
470
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