We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d7f93b5 commit 1c3d56dCopy full SHA for 1c3d56d
Tutorials/Basic/01_variables/04C_condtional_operations.js
@@ -9,14 +9,22 @@
9
* Syntax:
10
* variable = (condition) ? TRUE_value: FALSE_value
11
*/
12
+
13
let age = 18;
14
let canVote = (age >= 18) ? "Yes" : "No"; // ternary operator
15
console.log(canVote)
16
17
+// Another Example
18
19
+let speed = 90;
20
+// let speed = 50;
21
+let overSpeeding = (speed >=80 ) ? true: false
22
+console.log(overSpeeding)
23
24
// Multiple (Nested) Conditional (Ternary) operators
25
26
function checkInt (num) {
27
return (num > 0) ? "Positive" : (num < 0) ? "Negative" : "Zero";
28
}
29
-console.log(checkInt(0))
30
+console.log(checkInt(0))
0 commit comments