---
title: "Comment by Chau Giang on \"10 Incredible hacks that every JavaScript developer should know !!\" | Hashnode"
description: "Reduce = Map + Filter + ... Can you please explain why someArray.length = 0 is better than just someArray= [] - it is sort simple and more readable? About the p"
url: "https://hashnode.com/posts/10-incredible-hacks-that-every-javascript-developer-should-know/60a61cad4e7f9549fc3304ba/comment/60a655214e7f9549fc330d9a"
---

[Discussion](https://hashnode.com/posts/10-incredible-hacks-that-every-javascript-developer-should-know/60a61cad4e7f9549fc3304ba)

Comment [10 Incredible hacks that every JavaScript developer should know !!](https://hashnode.com/posts/10-incredible-hacks-that-every-javascript-developer-should-know/60a61cad4e7f9549fc3304ba)

[Chau Giang](https://hashnode.com/@chgiang)

[May 20, 2021](https://hashnode.com/posts/10-incredible-hacks-that-every-javascript-developer-should-know/60a61cad4e7f9549fc3304ba/comment/60a655214e7f9549fc330d9a)

1.  Reduce = Map + Filter + ...
    
2.  Can you please explain why `someArray.length = 0` is better than just `someArray= []` - it is sort simple and more readable?
    
3.  About the point `it gets difficult to keep track` we can use Proxy
    
4.  We can using Map or Object
    
5.  `console.time` has some caveats that why we have Performance API
    

[blog.bitsrc.io/using-the-performance-web-api-with…](https://blog.bitsrc.io/using-the-performance-web-api-with-chrome-devtools-f4c59564b3d4)

[Learn with HJ](https://hashnode.com/@hardeepjethwani)

[May 20, 2021](https://hashnode.com/posts/10-incredible-hacks-that-every-javascript-developer-should-know/60a61cad4e7f9549fc3304ba/comment/60a655214e7f9549fc330d9a#reply-60a657df4e7f9549fc330dfc)

Hi [Chau Giang](https://hashnode.com/@chgiang), Thanks for your comment.

As per my understanding and experience -

Using `someArray.length = 0` has an advantage that it wont allocate a new memory block. It will modify the existing variable "someArray".

Where as if you use `someArray= []` , It will create a new array and assign a reference to a new variable. So it will occupy one more block of a memory.
