---
title: "Comment by Ajay on \"Adding a Leading Zero in JavaScript\" | Hashnode"
description: "Short and simple. I implemented the same functionality with if-else conditions and it was verbose, but you just made it very simple - one line. Thanks for the s"
url: "https://hashnode.com/posts/adding-a-leading-zero-in-javascript/63c02eada54681f9eea772ff/comment/63c1164a2797281f03d62a5c"
---

[Discussion](https://hashnode.com/posts/adding-a-leading-zero-in-javascript/63c02eada54681f9eea772ff)

Comment [Adding a Leading Zero in JavaScript](https://hashnode.com/posts/adding-a-leading-zero-in-javascript/63c02eada54681f9eea772ff)

[Ajay](https://hashnode.com/@ajay020)

[Jan 13, 2023](https://hashnode.com/posts/adding-a-leading-zero-in-javascript/63c02eada54681f9eea772ff/comment/63c1164a2797281f03d62a5c)

Short and simple. I implemented the same functionality with if-else conditions and it was verbose, but you just made it very simple - one line. Thanks for the sharing it [Jennifer Bland](https://hashnode.com/@ratracegrad)

[Jennifer Bland](https://hashnode.com/@ratracegrad)

[Jan 15, 2023](https://hashnode.com/posts/adding-a-leading-zero-in-javascript/63c02eada54681f9eea772ff/comment/63c1164a2797281f03d62a5c#reply-63c46c08d72a4e43689daf0a)

Ajay,

I bet my old code is the same as yours. The more I programmed, I learned how to shorten it.
