---
title: "Discussion on \"Tenary Operators in JavaScript, Should I?\" | Hashnode"
description: "Discussion on \"Tenary Operators in JavaScript, Should I?\". Tenary operators are said to replace the if-else statements. When and how should tenary operators be used? In this article we would learn what tenary operators are and how it can be used.\nPrerequisite\n\nBasic JavaScript understanding\n\nTenary operators..."
url: "https://hashnode.com/posts/tenary-operators-in-javascript-should-i/5f3edf87dfbb4247f7c14afa"
---

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

Discussion

# [Tenary Operators in JavaScript, Should I?](https://pearl.hashnode.dev/tenary-operators-in-javascript-should-i?utm_source=hashnode&utm_medium=feed)

Tenary operators are said to replace the if-else statements. When and how should tenary operators be used? In this article we would learn what tenary operators are and how it can be used. Prerequisite Basic JavaScript understanding Tenary operators...

Aug 20, 2020 · 4 min read · pearl.hashnode.dev  
Read the article

-   [#javascript](https://hashnode.com/tag/javascript)
-   [#2articles1week](https://hashnode.com/tag/2articles1week)
-   [#devblogging](https://hashnode.com/tag/devblogging)
-   [#beginners](https://hashnode.com/tag/beginners)
-   [#clean-code](https://hashnode.com/tag/clean-code)

## Written by

[Osumgba Chiamaka](https://hashnode.com/@pearl)

@pearl · Abuja

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

@womentechmakers Lead | Community Builder | (Learn, Unlearn, relearn)

## Responses 2

Markdown supported · ⌘↵ to post

[Benson Imoh, ST](https://hashnode.com/@stbensonimoh)

[Aug 25, 2020](https://hashnode.com/posts/tenary-operators-in-javascript-should-i/5f3edf87dfbb4247f7c14afa/comment/5f4501466beb9714fc96a456)

> shorter codes do not equal cleaner codes

My favourite line. But it does the work.

[Luiz Filipe da Silva](https://hashnode.com/@luizfilipezs)

[Aug 20, 2020](https://hashnode.com/posts/tenary-operators-in-javascript-should-i/5f3edf87dfbb4247f7c14afa/comment/5f3efcd1dfbb4247f7c14bab)

Very well explained. Thanks for sharing!

[Osumgba Chiamaka](https://hashnode.com/@pearl)

[Aug 21, 2020](https://hashnode.com/posts/tenary-operators-in-javascript-should-i/5f3edf87dfbb4247f7c14afa/comment/5f3efcd1dfbb4247f7c14bab#reply-5f400ad9004ed8653f47cac9)

Thanks for reading.
