From 47006ac8442dddaa9e2e0bdb668b6ac17554a54f Mon Sep 17 00:00:00 2001 From: Ibrahim Abdulhameed Date: Sat, 30 Aug 2025 18:14:27 +0100 Subject: [PATCH] feat: add improved comments to js ternary op --- source/_posts/javascript.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/source/_posts/javascript.md b/source/_posts/javascript.md index 66920ab..cbc62cf 100644 --- a/source/_posts/javascript.md +++ b/source/_posts/javascript.md @@ -146,9 +146,11 @@ if (isMailSent) { ### Ternary Operator ```javascript +// The ternary operator is a concise way to write an if-else statement in a single line: condition ? exprIfTrue : exprIfFalse. + var x = 1; -// => true +// true, (condition) ? value_if_true : value_if_false result = x == 1 ? true : false; ```