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
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
CSC307 Lecture 08
javiergs
PRO
0
670
登壇資料を作る時に意識していること #登壇資料_findy
konifar
4
1k
Package Management Learnings from Homebrew
mikemcquaid
0
210
AgentCoreとHuman in the Loop
har1101
5
230
組織で育むオブザーバビリティ
ryota_hnk
0
170
Honoを使ったリモートMCPサーバでAIツールとの連携を加速させる!
tosuri13
1
170
LLM Observabilityによる 対話型音声AIアプリケーションの安定運用
gekko0114
2
420
0→1 フロントエンド開発 Tips🚀 #レバテックMeetup
bengo4com
0
550
16年目のピクシブ百科事典を支える最新の技術基盤 / The Modern Tech Stack Powering Pixiv Encyclopedia in its 16th Year
ahuglajbclajep
5
990
Grafana:建立系統全知視角的捷徑
blueswen
0
330
そのAIレビュー、レビューしてますか? / Are you reviewing those AI reviews?
rkaga
6
4.5k
CSC307 Lecture 04
javiergs
PRO
0
660
Featured
See All Featured
Hiding What from Whom? A Critical Review of the History of Programming languages for Music
tomoyanonymous
2
410
Building a Scalable Design System with Sketch
lauravandoore
463
34k
A brief & incomplete history of UX Design for the World Wide Web: 1989–2019
jct
1
300
VelocityConf: Rendering Performance Case Studies
addyosmani
333
24k
30 Presentation Tips
portentint
PRO
1
210
Visual Storytelling: How to be a Superhuman Communicator
reverentgeek
2
430
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.4k
Reflections from 52 weeks, 52 projects
jeffersonlam
356
21k
Tips & Tricks on How to Get Your First Job In Tech
honzajavorek
0
430
Between Models and Reality
mayunak
1
180
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
9.9k
Stewardship and Sustainability of Urban and Community Forests
pwiseman
0
110
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