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
TypeScript勉強記_Week5
Search
ko-chan
October 20, 2023
160
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
TypeScript勉強記_Week5
- JavaScript
- 繰り返し処理
-for...in文
-break文
-continue文
- 条件分岐
-if 文
-if...else 文
-if...else if 文
ko-chan
October 20, 2023
More Decks by ko-chan
See All by ko-chan
TypeScript勉強記_Week4
kochan648
0
220
TypeScript勉強記_Week3
kochan648
0
300
TypeScript勉強記_Week1
kochan648
0
430
TypeScript勉強記_Week2
kochan648
0
400
Featured
See All Featured
Technical Leadership for Architectural Decision Making
baasie
3
600
Sam Torres - BigQuery for SEOs
techseoconnect
PRO
0
580
エンジニアに許された特別な時間の終わり
watany
109
250k
Discover your Explorer Soul
emna__ayadi
2
1.3k
30 Presentation Tips
portentint
PRO
1
430
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
2
360
Java REST API Framework Comparison - PWX 2021
mraible
34
9.8k
Exploring anti-patterns in Rails
aemeredith
4
540
Learning to Love Humans: Emotional Interface Design
aarron
275
41k
Tell your own story through comics
letsgokoyo
1
1.1k
Measuring & Analyzing Core Web Vitals
bluesmoon
9
1k
Building Applications with DynamoDB
mza
96
7.2k
Transcript
文系出身プログラミング未経験人の TypeScript 勉強記 ~Week 5~
for…in文 オブジェクトに含まれるプロパティ名を順に取得することができる オブジェクトからプロパティ名が変数として格納され、 その後ブロック内の処理実行 ※プロパティ名は文字列の値として変数に格納される →プロパティ名を使ってプロパティの値を参照する場合 ❌ オブジェクト名.プロパティ名 ⭕ オブジェクト名[プロパティ名]
配列に対しても使用できる
break文 break文が記述されている一番内側の繰り返し処理を途中で終了し、 次の文へ処理を移すことができる 出力結果 1 2 4 8 end 16
end ・ ・ ・ 512 end 出力結果 1 2 4 8 end
continue文 繰り返し処理の残りの処理をスキップして、次の繰り返し処理を開始 出力結果 1 2 4 5 7 8 変数iの値が3の倍数の時、コンソールの出力処
理をスキップして次の繰り返し処理開始
0-2 条件分岐 if 文では記述した条件式がtrue or false によってする処理を分けることがで きる 条件式がtrueを返した場合、if の直後のブロック内に記
述された文を順番に実行 ①購入形態と金額を入力 ②if 文で定義されている条件 購入形態が’イートイン’となっていたらtrue ③実行内容 ・trueの場合 イートイン,110円 ・falseの場合 何も出力されない
if…else trueの場合の処理だけではなく、falseの場合も記述が可能になる 条件式がfalseを返した場合、elseのあとのブロック内に記 述された文を順番に実行 ①購入形態と金額を入力 ②falseの場合だとelse内の処理が実行 ※今回はイートイン以外の文字列はすべて false ③実行内容 ・falseの場合
テイクアウト 108円
ブロックの括弧を省略 trueまたはfalseの場合、実行する処理が一つの場合 { } が省略できる
if…else if 複数の条件式を組み合わせることができる 実行結果 ・条件式1がtrueの場合 イートイン 110円 ・条件式1がfalse,条件式2がtrueの場合 テイクアウト 108円 ・条件式1,条件式2がfalseの場合 正しい購入形態を入力してください