---
title: "Discussion on \"JavaScript if shorthand without the else\" | Hashnode"
description: "Discussion on \"JavaScript if shorthand without the else\". At one point in your career, you'll find yourself using the ternary operator in JavaScript a lot.\nIt's a fancy word for the if...else shorthand version.\nLet's recheck the example.\n// Full if else\n\nlet result = '';\nif (our_value) {\n  result = 'we got ..."
url: "https://hashnode.com/posts/javascript-if-shorthand-without-the-else/62e77069053e6bd578428e0c"
---

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

Discussion

# [JavaScript if shorthand without the else](https://h.daily-dev-tips.com/javascript-if-shorthand-without-the-else?utm_source=hashnode&utm_medium=feed)

At one point in your career, you'll find yourself using the ternary operator in JavaScript a lot. It's a fancy word for the if...else shorthand version. Let's recheck the example. // Full if else let result = ''; if (our\_value) { result = 'we got ...

Aug 1, 2022 · 2 min read · h.daily-dev-tips.com  
Read the article

-   [#javascript](https://hashnode.com/tag/javascript)
-   [#beginners](https://hashnode.com/tag/beginners)
-   [#web-development](https://hashnode.com/tag/web-development)

## Written by

[Chris Bongers](https://hashnode.com/@dailydevtips)

@dailydevtips · Cape Town, SA

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

Looking to get into development? As a full-stack developer I guide you on this journey and give you bite sized tips every single day 👊

I'm a full-stack developer from South Africa 🇿🇦. I love writing about JavaScript, HTML and CSS.

## Responses 1

Markdown supported · ⌘↵ to post

[Lokendra Bohra](https://hashnode.com/@lokendra17)

[Aug 2, 2022](https://hashnode.com/posts/javascript-if-shorthand-without-the-else/62e77069053e6bd578428e0c/comment/62e8db148f1d6b0345551ff6)

Nice Tutorial, You can also add Optional Chaining Operator in the list

[Chris Bongers](https://hashnode.com/@dailydevtips)

[Aug 2, 2022](https://hashnode.com/posts/javascript-if-shorthand-without-the-else/62e77069053e6bd578428e0c/comment/62e8db148f1d6b0345551ff6#reply-62e8e05b8f1d6b0345552155)

Here you go: [daily-dev-tips.com/posts/javascript-optional-chai…](https://daily-dev-tips.com/posts/javascript-optional-chaining-to-the-rescue/)
