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
if文のはなし
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
tky
March 22, 2019
Programming
600
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
if文のはなし
tky
March 22, 2019
Other Decks in Programming
See All in Programming
Copilot CLI の継戦能力を高める コンテキスト管理
nozomutu
1
1.2k
Spec Driven Development | AI Summit Lisbon
danielsogl
PRO
0
180
Spec-Driven Development with AI-Agents: From High-Level Requirements to Working Software
antonarhipov
2
490
「エンジニアインターン、どうやって取った?」準備のリアルを語るLT会 Progate BAR
akiomatic
0
130
依存関係から依存物へ―Dependencyという言葉の歴史をひも解く
j_lee
0
110
タクシーアプリ『GO』の バックエンド開発のおける AI利活用と若者のすべて
pyama86
3
2k
LLM本来の能力を解き放つサンドボックス技術とAI民主化への適用
yukukotani
3
3.6k
The ROI of Quarkus for Spring Boot Applications
hollycummins
0
110
ローカルLLMでどこまでコードが書けるか -拡張版 / How much code can be written on a local LLM Extended
kishida
2
280
Agentic UI
manfredsteyer
PRO
0
130
エージェンティックRAGにAWSで入門しよう!
har1101
8
1.4k
AIチームを指揮するOSS「TAKT」活用術 / How to Use “TAKT,” an OSS Tool for Orchestrating AI Teams
nrslib
6
880
Featured
See All Featured
Measuring Dark Social's Impact On Conversion and Attribution
stephenakadiri
2
210
Visual Storytelling: How to be a Superhuman Communicator
reverentgeek
2
560
世界の人気アプリ100個を分析して見えたペイウォール設計の心得
akihiro_kokubo
PRO
71
40k
How to build an LLM SEO readiness audit: a practical framework
nmsamuel
1
770
DBのスキルで生き残る技術 - AI時代におけるテーブル設計の勘所
soudai
PRO
65
55k
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
Winning Ecommerce Organic Search in an AI Era - #searchnstuff2025
aleyda
1
2k
SEO for Brand Visibility & Recognition
aleyda
0
4.6k
The Cult of Friendly URLs
andyhume
79
6.9k
First, design no harm
axbom
PRO
2
1.2k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
2.9k
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
1
210
Transcript
if文のはなし @ticktakclock
自己紹介 • 竹中貴哉 @ticktakclock • React, Cordova • javascript 始めて
6 ヶ月経ちました • 本業は Android
if ...
const str = 'we are javascripters'; console.log(`length: ${str.length}`); if (str.length
> 0) { // true console.log('ok'); } // > length: 20 // > ok
const str = 'we are javascripters'; if (str.startsWith('we')) { //
true console.log('ok'); } // > ok
if文はtrue/falseで判定するんだ!
const str = 'we are javascripters'; console.log(str); if (str) {
console.log('ok'); } // > we are javascripters // > ok
const str = 'we are javascripters'; console.log(str); if (str !==
null) { console.log('ok'); } // > we are javascripters // > ok
const str = 'we are javascripters'; console.log(str); if (str) {
console.log('ok'); } // > we are javascripters // > ok
ドキュメント https://developer.mozilla.org/ja/docs/Web/JavaScript/Reference/Statements/if...else#Syntax
truthy? falsy?
truthy https://developer.mozilla.org/ja/docs/Glossary/truthy
const str = 'we are javascripters'; console.log(str); if (str !==
null) { console.log('ok'); } // > we are javascripters // > ok
const str = 'we are javascripters'; console.log(str); if (str) {
console.log('ok'); } // > we are javascripters // > ok
やってみた console.log(0 ? 'truthy' : 'falsy'); // falsy console.log(1 ?
'truthy' : 'falsy'); // truthy console.log(-1 ? 'truthy' : 'falsy'); // truthy console.log('' ? 'truthy' : 'falsy'); // falsy console.log('test' ? 'truthy' : 'falsy'); // truthy console.log(undefined ? 'truthy' : 'falsy'); // falsy console.log(null ? 'truthy' : 'falsy'); // falsy console.log('undefined' ? 'truthy' : 'falsy'); // truthy console.log(new Date() ? 'truthy' : 'falsy'); // truthy
まとめ if文の条件式は何でも入る
string https://www.ecma-international.org/publications/files/ECMA-ST-ARCH/ECMA-262,%201st%20edition,% 20June%201997.pdf
おしまい
string https://developer.mozilla.org/ja/docs/Web/JavaScript/Data_structures#Strings
var str = ''; console.log(str[0]); // undefined console.log(str.length); // 0
console.log(str.charCodeAt(0)); // NaN str = '\0'; console.log(str[0]); // ’ ’ console.log(str.length); // 1 console.log(str.charCodeAt(0)); // 0