Basic JavaScript (109/111) | Use Multiple Conditional Ternary Operators | freeCodeCamp
Автор: Stral Tech
Загружено: 2020-12-21
Просмотров: 600
Описание:
Basic JavaScript (109/111) | Use Multiple Conditional Ternary Operators | freeCodeCamp
Full playlist 👉 • Basic JavaScript (1/111) | Comment Your Ja...
In the previous challenge, you used a single conditional operator. You can also chain them together to check for multiple conditions.
The following function uses if, else if, and else statements to check multiple conditions:
It is considered best practice to format multiple conditional operators such that each condition is on a separate line, as shown above. Using multiple conditional operators without proper indentation may make your code hard to read. For example:
In the checkSign function, use multiple conditional operators - following the recommended format used in findGreaterOrEqual - to check if a number is positive, negative or zero. The function should return "positive", "negative" or "zero".
Повторяем попытку...
Доступные форматы для скачивания:
Скачать видео
-
Информация по загрузке: