<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/terned-backwards-mhttbx4wi" -->

---
title: Terned Backwards | daily.dev
description: A developer hunting bugs found a correct one-line ternary expression handling SI vs binary storage unit conversion in JavaScript, then replaced it with ten...
canonical: https://daily.dev/posts/terned-backwards-mhttbx4wi
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Terned Backwards | daily.dev
og:description: A developer hunting bugs found a correct one-line ternary expression handling SI vs binary storage unit conversion in JavaScript, then replaced it with ten...
og:url: https://daily.dev/posts/terned-backwards-mhttbx4wi
og:image: https://api.daily.dev/og/posts/mhTTBX4WI.png
og:image:alt: Terned Backwards
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Terned Backwards

**[The Daily WTF](https://daily.dev/sources/thedailywtf)** · 2 min read · 3 upvotes · 1 comments

## Summary

A developer hunting bugs found a correct one-line ternary expression handling SI vs binary storage unit conversion in JavaScript, then replaced it with ten lines of incorrect code. The rewrite discards `const`, compares booleans against boolean literals instead of using simple negation, skips `else` where appropriate, and critically inverts the logic — assigning base 1000 when SI is false and base 1024 when SI is true, the exact opposite of correct behavior.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://thedailywtf.com/articles/terned-backwards>

## Community discussion

Top comments from developers on daily.dev.

**@alexeyzerkalenkov** · 0 upvotes

> OMG, these intrepid junior developers!
>
> I love ternary operations for their clarity and brevity. In measured quantities.

## Similar posts on daily.dev

- [Cheap code can still create expensive decisions](https://daily.dev/posts/cheap-code-can-still-create-expensive-decisions-s5omps1xq) · Flavio Copes · 2 upvotes · 1 comments
- [The V8 JavaScript Runtime Undermined My Constant-Time JavaScript Library](https://daily.dev/posts/the-v8-javascript-runtime-undermined-my-constant-time-javascript-library-g9jlr7qsx) · Dhole Moments · 6 upvotes · 2 comments
- [A Sudden Tern](https://daily.dev/posts/a-sudden-tern-dntb9ggqe) · The Daily WTF · 0 upvotes · 0 comments
- [Most JavaScript Developers Get == Wrong in Interviews \(Not Because It's Hard\)](https://daily.dev/posts/most-javascript-developers-get-wrong-in-interviews-not-because-it-s-hard--i6iheuzwh) · Medium · 1 upvotes · 0 comments
- [Solidity 0.8.38 Release Announcement](https://daily.dev/posts/solidity-0-8-38-release-announcement-mu9kdosuj) · Solidity · 0 upvotes · 0 comments

---

Tags: [#javascript](https://daily.dev/tags/javascript)

[View this post on daily.dev](https://daily.dev/posts/terned-backwards-mhttbx4wi)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Terned Backwards","url":"https://daily.dev/posts/terned-backwards-mhttbx4wi","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/terned-backwards-mhttbx4wi"},"datePublished":"2026-02-19T12:19:53.224Z","dateModified":"2026-02-19T12:20:10.468Z","description":"A developer hunting bugs found a correct one-line ternary expression handling SI vs binary storage unit conversion in JavaScript, then replaced it with ten...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/677fcc59be1ff9fab043338edbaa89c2?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/677fcc59be1ff9fab043338edbaa89c2?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"The Daily WTF","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"The Daily WTF","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/d21a6aa61a7244d893a3b3284df8e2ef","url":"https://daily.dev/sources/thedailywtf"},"commentCount":1,"discussionUrl":"https://daily.dev/posts/terned-backwards-mhttbx4wi","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":3},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":1}],"keywords":"javascript","timeRequired":"PT2M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"The Daily WTF","item":"https://daily.dev/sources/thedailywtf"},{"@type":"ListItem","position":3,"name":"Terned Backwards"}]}
{"@context":"https://schema.org","@type":"WebPage","@id":"https://daily.dev/posts/terned-backwards-mhttbx4wi","comment":[{"@type":"Comment","text":"OMG, these intrepid junior developers!\nI love ternary operations for their clarity and brevity. In measured quantities.","datePublished":"2026-02-20T07:33:29.258Z","url":"https://daily.dev/posts/mhTTBX4WI#c-7rdbedFBp","author":{"@type":"Person","name":"Alexey Zerkalenkov","url":"https://daily.dev/alexeyzerkalenkov","image":"https://lh3.googleusercontent.com/a/ACg8ocKQBwPwaHC4XrPy0rniDybogCxlwDp7QCLkbwsqNRQSFhqDIlIf=s96-c"}}]}
```

