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
You don't know JavaScript
Search
C1nde
October 03, 2015
Programming
0
180
You don't know JavaScript
C1nde
October 03, 2015
Tweet
Share
Other Decks in Programming
See All in Programming
プロパティベーステストによるUIテスト: LLMによるプロパティ定義生成でエッジケースを捉える
tetta_pdnt
0
1.7k
ファインディ株式会社におけるMCP活用とサービス開発
starfish719
0
1.6k
250830 IaCの選定~AWS SAMのLambdaをECSに乗り換えたときの備忘録~
east_takumi
0
390
Ruby Parser progress report 2025
yui_knk
1
440
Testing Trophyは叫ばない
toms74209200
0
880
機能追加とリーダー業務の類似性
rinchoku
2
1.3k
そのAPI、誰のため? Androidライブラリ設計における利用者目線の実践テクニック
mkeeda
2
310
意外と簡単!?フロントエンドでパスキー認証を実現する WebAuthn
teamlab
PRO
2
760
FindyにおけるTakumi活用と脆弱性管理のこれから
rvirus0817
0
520
testingを眺める
matumoto
1
140
Kiroで始めるAI-DLC
kaonash
2
590
Compose Multiplatform × AI で作る、次世代アプリ開発支援ツールの設計と実装
thagikura
0
160
Featured
See All Featured
The Art of Programming - Codeland 2020
erikaheidi
56
13k
We Have a Design System, Now What?
morganepeng
53
7.8k
What’s in a name? Adding method to the madness
productmarketing
PRO
23
3.7k
Building Better People: How to give real-time feedback that sticks.
wjessup
368
19k
What's in a price? How to price your products and services
michaelherold
246
12k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
22k
Six Lessons from altMBA
skipperchong
28
4k
Done Done
chrislema
185
16k
Stop Working from a Prison Cell
hatefulcrawdad
271
21k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
188
55k
Being A Developer After 40
akosma
90
590k
Statistics for Hackers
jakevdp
799
220k
Transcript
You don’t know JavaScript @C1nde
None
>>> study[0] simple math
>>> [] + [] ""
>>> [] + [] "" >>> {} + {} NaN
>>> [] + [] "" >>> {} + {} NaN
>>> [] + {} "[object Object]"
>>> [] + [] "" >>> {} + {} NaN
>>> [] + {} "[object Object]" >>> {} + [] 0
>>> study[1] Boolean
>>> if (true) { console.log('Will be printed'); } >>> if
(false) { console.log('Will not be printed'); }
>>> if (new Boolean(false)) { console.log('hmmmm'); } hmm
>>> if (new Boolean(false)) { console.log('hmmmm'); } hmm >>> if
(Boolean(false)) { console.log('as expected'); }
>>> study[2] NaN
>>> isNaN(new Date()); false >>> isNaN(new Date('notADate')); true
>>> isNaN(null); false
>>> isNaN(null); false >>> isNaN(undefined); true
>>> isNaN(null); false >>> isNaN(undefined); true >>> undefined == NaN;
false
>>> isNaN(null); false >>> isNaN(undefined); true >>> undefined == NaN;
false >>> NaN == NaN; false
>>> study[3] Object
>>> var o = {}; >>> typeof o "object"
>>> var o = {}; >>> typeof o "object" >>>
o instanceof Object true
>>> typeof null "object"
>>> typeof null "object" >>> null instanceof Object false
>>> study[3] Object^W Null
>>> study[4] RegEx
>>> var lowerCaseOnly = /^[a-z]+$/;
>>> var lowerCaseOnly = /^[a-z]+$/; >>> lowerCaseOnly.test('a'); true >>> lowerCaseOnly.test('A');
false >>> lowerCaseOnly.test(''); false
>>> var lowerCaseOnly = /^[a-z]+$/; >>> lowerCaseOnly.test(null); true >>> lowerCaseOnly.test(undefined);
true >>> lowerCaseOnly.test(); true
>>> study[5] String
>>> 'a string' === 'a string' true
>>> 'a string' === 'a string' true >>> new String('a
string') === 'a string' false
>>> 'a string' === 'a string' true >>> new String('a
string') === 'a string' false >>> String('a string') === 'a string' true
>>> study[6] String & RegEx
>>> var address = 'http://storage. com/gifs/picture.jpg'; >>> address.match('.gif');
>>> var address = 'http://storage. com/gifs/picture.jpg'; >>> address.match('.gif'); /gif
>>> study[7] Object
>>> var obj = { its: 1, an: 2, obj:
3 }; >>> obj.its = null; >>> obj.an = undefined; >>> delete obj.obj;
>>> for(var item in obj) { if (obj.hasOwnProperty(item)) { console.log(item,
obj[item]); } } its null an undefined
>>> study[8] prototype
>>> var obj = {}; >>> var proto = Object.prototype;
>>> proto.isPrototypeOf(obj); false >>> Object.isPrototypeOf(obj); false
>>> var obj = new Object(); >>> var proto =
Object.prototype; >>> proto.isPrototypeOf(obj); false >>> Object.isPrototypeOf(obj); false
>>> var obj = {}; >>> var proto = Object.prototype;
>>> proto === Object.getPrototypeOf (obj); true
>>> study[9] ???
>>> undefined == null; true
[~] > cat check.coffee obj = prop: value if obj.prop?
console.log obj.prop [~] > coffee -b -p check.coffee var obj; obj = { prop: value }; if (obj.prop != null) { console.log(obj.prop); }
THANKS