---
title: "Discussion on \"Why Your `if / else` Took the Wrong Branch: 4 JavaScript Condition Traps\" | Hashnode"
description: "Discussion on \"Why Your `if / else` Took the Wrong Branch: 4 JavaScript Condition Traps\". \"My if is wrong\" is almost never true. The if did exactly what you wrote. It just took a different branch from the one you had in your head.\nThat gap between the branch you expected and the branch tha"
url: "https://hashnode.com/posts/why-your-if-else-took-the-wrong-branch-4-javascript-condition-traps/6b11011edbcf9bcaa7c8f33c"
---

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

Discussion

# [Why Your \`if / else\` Took the Wrong Branch: 4 JavaScript Condition Traps](https://codeglyphs.hashnode.dev/why-your-if-else-took-the-wrong-branch-4-javascript-condition-traps?utm_source=hashnode&utm_medium=feed)

"My if is wrong" is almost never true. The if did exactly what you wrote. It just took a different branch from the one you had in your head. That gap between the branch you expected and the branch tha

1d ago · 10 min read · codeglyphs.hashnode.dev  
Read the article

## Written by

[Iineman2](https://hashnode.com/@lineman2)

@lineman2

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

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
