---
title: "Discussion on \"What is the ternary operator in JavaScript?\" | Hashnode"
description: "Discussion on \"What is the ternary operator in JavaScript?\". The Conditional (ternary) is a shorthand way of writing simple if-else statements in JavaScript. It's denoted by the ? : syntax and takes the following form:\ncondition ? expressionIfTrue : expressionIfFalse;\n\nHere's how it works:\n\nThe condition is an..."
url: "https://hashnode.com/posts/what-is-the-ternary-operator-in-javascript/64c028743d0d5beec2f4cbb7"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [What is the ternary operator in JavaScript?](https://wpgroom.hashnode.dev/what-is-the-ternary-operator-in-javascript?utm_source=hashnode&utm_medium=feed)

The Conditional (ternary) is a shorthand way of writing simple if-else statements in JavaScript. It's denoted by the ? : syntax and takes the following form: condition ? expressionIfTrue : expressionIfFalse; Here's how it works: The condition is an...

Jul 25, 2023 · 1 min read · wpgroom.hashnode.dev  
Read the article

-   [#ternary-operator](https://hashnode.com/tag/ternary-operator)
-   [#javascript](https://hashnode.com/tag/javascript)
-   [#conditional](https://hashnode.com/tag/conditional)
-   [#operators](https://hashnode.com/tag/operators)

## Written by

[Agbeniga Agboola](https://hashnode.com/@wpgroom)

@wpgroom

  
[View profile](https://hashnode.com/@wpgroom)

Crafting code into clear, concise language

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
