---
title: "Discussion on \"Why Is {} > []?\" | Hashnode"
description: "Discussion on \"Why Is {} > []?\". TLDR version\nRelational Comparisons\nIn JavaScript, the result of a relational comparison is determined by the Abstract Relational Comparison algorithm.  The algorithm converts both sides of a comparison to primitive values and then returns the result..."
url: "https://hashnode.com/posts/why-is-empty-object-greater-than-empty-array/5fbd7210daba2d288c5517b5"
---

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

Discussion

# [Why Is {} > \[\]?](https://blog.amyshackles.com/why-is-empty-object-greater-than-empty-array?utm_source=hashnode&utm_medium=feed)

TLDR version Relational Comparisons In JavaScript, the result of a relational comparison is determined by the Abstract Relational Comparison algorithm. The algorithm converts both sides of a comparison to primitive values and then returns the result...

Nov 24, 2020 · 7 min read · blog.amyshackles.com  
Updated Nov 25, 2020  
Read the article

-   [#javascript](https://hashnode.com/tag/javascript)
-   [#ecmascript](https://hashnode.com/tag/ecmascript)

## Written by

[Amy Shackles](https://hashnode.com/@AmyShackles)

@AmyShackles · Washington, US

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

Automate, integrate, motivate, renovate, substantiate

I worked in the transcription industry for a decade before transitioning into the tech field. When I'm not programming or doing something programming-related, I'm cuddling cats, doing karaoke, practicing calligraphy, or coloring.

## Responses 1

Markdown supported · ⌘↵ to post

[Martijn Imhoff](https://hashnode.com/@MartijnImhoff)

[Nov 25, 2020](https://hashnode.com/posts/why-is-empty-object-greater-than-empty-array/5fbd7210daba2d288c5517b5/comment/5fbeaf94d73a0534d9b51539)

When I open the console. I get this... ![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1606332282494/g3WXVkTbA.png)

[Amy Shackles](https://hashnode.com/@AmyShackles)

[Nov 25, 2020](https://hashnode.com/posts/why-is-empty-object-greater-than-empty-array/5fbd7210daba2d288c5517b5/comment/5fbeaf94d73a0534d9b51539#reply-5fbecf1808c16c34b89c4821)

This is actually a good point to bring up.

The way that the specification for JavaScript is written, block statements are evaluated before expressions, so when the interpreter sees curly braces when not in an expression context, it interprets them as a block rather than an object literal. That's why you get an error when you attempt to run those expressions in the browser. The way to force the interpreter to see {} as an object literal instead of as a block is to wrap it in parentheses.

![({}) > \[\] // true; ({}) < \[\] // false; ({}) == "\[object Object\]" // true](https://github.com/AmyShackles/AmyShackles/blob/master/parens-with-%7B%7D%3E%5B%5D.png?raw=true)

If you were to open a Node console rather than a browser console, you would see:

![{} > \[\] // true; > {} < \[\] // false; {} == "\[object Object\]" // true](https://github.com/AmyShackles/AmyShackles/blob/master/%7B%7D%20%3E%20%5B%5D.png?raw=true)

This is because Node made a change to evaluate input as expressions before evaluating them as statements. That change can be seen [here](https://github.com/nodejs/node/blob/651088c3e6b6399a3e656e397c3845b970ad7903/lib/repl.js#L355-L358).
