We take a look at the ternary operator in Javascript together. This allows us to shorten certain types of conditional statements down to a single expression. There are several caveats to using this syntax which we explore.
We also look at how this helps us with the newer arrow function expression syntax as well as within high-order array functions like map.
This is part of a series where we go over Javascript in depth to learn programming concepts as well as web development: • Javascript In Depth
Chapters:
00:00 Introduction
00:37 Ternary Operator Intro
04:27 Ternary Code Example
09:13 Ternary in Functions
11:44 Ternary Function Examples
15:55 Arrow Function Expressions
17:58 Arrow Function Expression Example
20:51 Ternary with Array Map
22:53 Ternary Array Map Examples
26:51 Ternary Common Mistake
28:57 Nested Ternary Statements
33:22 Next Steps
📦 Github Repository with the notes and exercise code+solutions: https://github.com/Nooder/javascript-...
💬 Come join us on Discord to chat with a like-minded community about tech and learning: / discord
🏅Support the channel and content through Super Thanks, Channel Memberships, or on Patreon: / techwithnader