---
title: "Discussion on \"10 Incredible hacks that every JavaScript developer should know !!\" | Hashnode"
description: "Discussion on \"10 Incredible hacks that every JavaScript developer should know !!\". JavaScript can help perform complex operations on web pages. There are tones of JavaScript developers around the globe but, only few of them have a practice of writing down an optimized JavaScript code.\nAn optimized code is a combination of smartly p..."
url: "https://hashnode.com/posts/10-incredible-hacks-that-every-javascript-developer-should-know/60a61cad4e7f9549fc3304ba"
---

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

Discussion

# [10 Incredible hacks that every JavaScript developer should know !!](https://hardeepjethwani.hashnode.dev/10-incredible-hacks-that-every-javascript-developer-should-know?utm_source=hashnode&utm_medium=feed)

JavaScript can help perform complex operations on web pages. There are tones of JavaScript developers around the globe but, only few of them have a practice of writing down an optimized JavaScript code. An optimized code is a combination of smartly p...

May 20, 2021 · 4 min read · hardeepjethwani.hashnode.dev  
Read the article

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

## Written by

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

@hardeepjethwani · India

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

Senior Software Engineer @ HSBC | Cloud Wizard

Hey there! 👋 I'm Hardeep Jethwani (HJ), your resident cloud aficionado and code maestro, proudly navigating the ever-changing seas of AWS Cloud and Full Stack Development for ~5 glorious years and counting. ☁️💻 Currently, I'm orchestrating the tech symphony as part of Team HSBC Bank, where I'm on a mission to enhance the banking experience through the magic of technology. 🚀💼 In my past life at Capgemini, I led exciting adventures like migrating critical applications to the cloud (18 and counting!). I had databases waltzing into the AWS Cloud, sprinkling a bit of containerization magic along the way. AWS managed services like RDS, Lambda, ECS, and friends? They were my trusty sidekicks. 🎩🔧 When not automating deployments with CI/CD finesse (think AWS CodePipeline, CodeBuild, and CodeDeploy), you might find me designing infrastructure like a digital architect using AWS CloudFormation. Security is my jam – I've got WAF, Security Groups, MFA, Cognito, and even a secret club in private subnets to keep things safe. 🔒💂‍♂️ On top of all that, I'm on a mission to reduce carbon footprints because, why not? HSBC's commitment to sustainability is my heart and soul. We're going for NET ZERO carbon footprint, and I'm leading the charge, one container at a time! 🌍🌱 And yes, the fun doesn't stop at work. In my past life at Tata Consultancy Services, I co-created a multi-tier Point of Sale application with a global footprint, touching the lives of billions. My automation tools were so efficient that even Father Time was left scratching his head. ⏳💡 If you're in need of a cloud-savvy comedian or a code deployment magician, look no further. Let's chat about tech, swap automation tales, or share some coding humor over a virtual coffee. Oh, and don't worry; I promise not to write code in my sleep (well, most of the time). Cheers to cloud adventures! ☕🚀

## Responses 6

Markdown supported · ⌘↵ to post

[Alfiya Saifee](https://hashnode.com/@Alfi)

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

Very nice it is good guide for me. Keep it up☺️

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

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

Glad you like it 😊

[Eleftheria Batsou](https://hashnode.com/@eleftheriabatsou)

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

That was a nice read [Hardeep Jethwani](https://hashnode.com/@hardeepjethwani), I didn't know quite a few of these things :)

[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/60a65c48b4e16849d76dc8db#reply-60a66077b4e16849d76dc946)

Thanks [Eleftheria Batsou](https://hashnode.com/@eleftheriabatsou), Glad to know that :)

[Sanvi Merin](https://hashnode.com/@sanvimerin)

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

Wow! Thanks!

[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/60a65598b4e16849d76dc7f1#reply-60a6581cb4e16849d76dc868)

[Sanvi Merin](https://hashnode.com/@sanvimerin) my pleasure :)

[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.

[Shivam](https://hashnode.com/@varUndefined)

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

Hi hardeep,

I wasn't aware of the performance module. That looks really promising. Though to measure time between two points, one can also use console.time, and it directly outputs the difference.

![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1621504884340/ca25CpHp4h.png)

Cheers Shivam

[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/60a633dbb4e16849d76dc34c#reply-60a63cdab4e16849d76dc544)

[Shivam](https://hashnode.com/@varUndefined) Thanks to share this :)

Now we have a one more hack here :D
