---
title: "Discussion on \"when to use Ternary operator(?:) and logical AND (&&)\" | Hashnode"
description: "Discussion on \"when to use Ternary operator(?:) and logical AND (&&)\". The choice between a ternary operator and the && operator in programming generally depends on whether you need to return one of two different values or conditionally execute a single expression or return a default value, respectively. \nWhen to use th..."
url: "https://hashnode.com/posts/when-to-use-ternary-operator-and-logical-and-andand/6970f6e1f8b34e9a44fc5469"
---

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

Discussion

# [when to use Ternary operator(?:) and logical AND (&&)](https://destructuring-and-conditional-rendering.hashnode.dev/when-to-use-ternary-operator-and-logical-and-andand?utm_source=hashnode&utm_medium=feed)

The choice between a ternary operator and the && operator in programming generally depends on whether you need to return one of two different values or conditionally execute a single expression or return a default value, respectively. When to use th...

Jan 21 · 2 min read · destructuring-and-conditional-rendering.hashnode.dev  
Read the article

-   [#ternary-operator-and-logical-andand](https://hashnode.com/tag/ternary-operator-and-logical-andand)

## Written by

[Pranay Manusmare](https://hashnode.com/@PranayManusmare)

@PranayManusmare

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

Keep learning and exploring

Frontend Developer | React &amp; JavaScript Lover ⚛️ | Building cool web apps &amp; sharing my learning journey 💻🚀

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
