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
同じってなんだ?
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Hirofumi Horiuchi
September 27, 2021
40
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
同じってなんだ?
Hirofumi Horiuchi
September 27, 2021
More Decks by Hirofumi Horiuchi
See All by Hirofumi Horiuchi
Stimulusのはなし
h_reader
0
43
OSSを読んでみた?
h_reader
0
59
vue_js_composition_api
h_reader
0
71
秒速でリリースするWebアプリ.pdf
h_reader
0
53
はじめよう async/await
h_reader
0
55
Node.jsではじめるオレオレツールの世界
h_reader
0
520
Featured
See All Featured
Noah Learner - AI + Me: how we built a GSC Bulk Export data pipeline
techseoconnect
PRO
0
430
Sam Torres - BigQuery for SEOs
techseoconnect
PRO
0
540
Primal Persuasion: How to Engage the Brain for Learning That Lasts
tmiket
0
450
Building Better People: How to give real-time feedback that sticks.
wjessup
370
20k
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.8k
Accessibility Awareness
sabderemane
1
210
Navigating Team Friction
lara
192
16k
Visual Storytelling: How to be a Superhuman Communicator
reverentgeek
2
660
The Power of CSS Pseudo Elements
geoffreycrofte
82
6.6k
jQuery: Nuts, Bolts and Bling
dougneiner
66
8.6k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
1.3k
Visualization
eitanlees
152
17k
Transcript
同じってなんだ?
Hello! I am Hirofumi Horiuchi. Corp: Job: IoT Engineer Hobby:
Camp, Watting Football @h_reader 2
“ プログラミングの世界で 同じかどうかを比較するには 主に == を使います。
“ a == 2 とか
“ Javascriptでは == と === があり これは違う比較です
“ Javascriptでいう 同じとは何なのでしょうか?
== と === の違い == とは 等値演算子 (ざっくり等しい) === とは同値演算子
(きっちり等しい)
“ 10 と 10 は等しい?
“ 10 == 10 -> true 10 === 10 ->
true
“ 10 と “10“ は等しい?
“ 10 == “10” -> true 10 === “10” ->
false
“ 16 と “0x10” は等しい?
“ 16 == “0x10” -> true 16 === “0x10” ->
false
“ 1 と true は等しい?
“ 1 == true -> true 1 === true ->
false
“ 1 と “true” は等しい?
“ 1 == ‘true’ -> false 1 === ‘true’ ->
false
“ “str”と new String(‘str’)は等しい?
“ “str” == new String(“str”) -> true “str” === new
String(“str”) -> false
“ null と undifined は等しい?
“ null == undefined -> true null === undefined ->
false
“ null と “” は等しい?
“ null == “” -> false null === “” ->
false
== と === の違いまとめ 条件式 == === 10 == 10
true true 10 == “10” true false 16 == “0x10” true false 1 == true true false 1 == ‘true’ false false “str” == new String(“str”) true false null == undefined true false “” == null false false
結局どう使えばいいの? ・値を比較したい場合、 === を使った方が安全 (10 と “10” は別だから) ・Nullチェックは、 ==
を使うのが楽 (null も undefined も、両方チェックしたいから) ただし、空文字は引っかからないので注意 ・Switch文は === の比較になる ・やはりエディタはVSCode
26 Thanks! Any questions? You can find me at ▪
@h_reader