---
title: "Discussion on \"20 Killer JavaScript One Liners ☝️\" | Hashnode"
description: "Discussion on \"20 Killer JavaScript One Liners ☝️\". Super handy one line snippets to make your life easier"
url: "https://hashnode.com/posts/20-killer-javascript-one-liners/6146f17da2b54e17a52c38b6"
---

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

Discussion

# [20 Killer JavaScript One Liners ☝️](https://blog.saviomartin.com/20-killer-javascript-one-liners?utm_source=hashnode&utm_medium=feed)

Super handy one line snippets to make your life easier

Sep 19, 2021 · 4 min read · blog.saviomartin.com  
Read the article

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

## Written by

[Savio Martin](https://hashnode.com/@saviomartin)

@saviomartin · Kerala, India

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

Focused on Frontend, love backend too

Savio Martin is a 14 year old who spends time building useful products. He is a designer, front-end web developer, and content creator.

## Responses 7

Markdown supported · ⌘↵ to post

[Dave Bray](https://hashnode.com/@bravedave)

[Aug 9, 2022](https://hashnode.com/posts/20-killer-javascript-one-liners/6146f17da2b54e17a52c38b6/comment/62f1c24878c42064d1f341c5)

Hey Savio - loved your one liners and used the isDateValid one ... until

On iOS new Date('2009-10-11 11:01:01') is Invalid

on Chrome new Date('2009-10-11 11:01:01') Sun Oct 11 2009 11:01:01 GMT+1000 (Australian Eastern Standard Time)

clearly I'm in Oz ...

It's hard to debug iOS as I use Win11

cheers

[shobhit kumar](https://hashnode.com/@shobhit094)

[Jul 5, 2022](https://hashnode.com/posts/20-killer-javascript-one-liners/6146f17da2b54e17a52c38b6/comment/62c3ccc3c0401b3dcbcff274)

I saw many young guys wasting their time by bing watch which is not useful and you are awesome. Great Job!! all the best for fantastic future.[Savio Martin](https://hashnode.com/@saviomartin)

I think minor typo at very first heading "Get Value of a **brower** Cookie" should be **browser**

[Marko Denic](https://hashnode.com/@denic)

[Oct 1, 2021](https://hashnode.com/posts/20-killer-javascript-one-liners/6146f17da2b54e17a52c38b6/comment/61571250e896275f335e11e2)

Excellent write-up, Savio. You can find a few more [JavaScript tips](https://markodenic.com/javascript-tips/) here.

Thanks for the efforts!

[Ankur Tyagi](https://hashnode.com/@TheAnkurTyagi)

[Sep 20, 2021](https://hashnode.com/posts/20-killer-javascript-one-liners/6146f17da2b54e17a52c38b6/comment/6147f8e4699fe76cd348389b)

Excellent Work [Savio Martin](https://hashnode.com/@saviomartin)

[Savio Martin](https://hashnode.com/@saviomartin)

[Sep 20, 2021](https://hashnode.com/posts/20-killer-javascript-one-liners/6146f17da2b54e17a52c38b6/comment/6147f8e4699fe76cd348389b#reply-6147fbf9699fe76cd34838b6)

Thank you buddy, makes me motivated to write more in this series. Surely more killer one liners coming soon here! 🎉🔥

[Antonio Pekeljevic](https://hashnode.com/@antoniopk)

[Sep 19, 2021](https://hashnode.com/posts/20-killer-javascript-one-liners/6146f17da2b54e17a52c38b6/comment/614742bf699fe76cd3482ad5)

Good job, I really like the list!

I have recently played with `window.getSelection();` and if you are using it in an `.addEventListener('click'=>{});` function and you click on a non-text area, you will always get the first element that is in the horizontal line of the window. That happens because the caret is always at the start of the window and will give you the next element that is in the line since it counts it as selected.

I found that a bit unexpected but it works like that. Keep up the good work!

[Savio Martin](https://hashnode.com/@saviomartin)

[Sep 20, 2021](https://hashnode.com/posts/20-killer-javascript-one-liners/6146f17da2b54e17a52c38b6/comment/614742bf699fe76cd3482ad5#reply-6147fc0f699fe76cd34838bd)

Thanks mate, you're a genius. Keep it up!

[Agrit Tiwari](https://hashnode.com/@agrittiwari)

[Sep 19, 2021](https://hashnode.com/posts/20-killer-javascript-one-liners/6146f17da2b54e17a52c38b6/comment/614704bf699fe76cd348253c)

Great! covered diverse areas.

[Savio Martin](https://hashnode.com/@saviomartin)

[Sep 20, 2021](https://hashnode.com/posts/20-killer-javascript-one-liners/6146f17da2b54e17a52c38b6/comment/614704bf699fe76cd348253c#reply-6147fc2217da986cea646d09)

Thank you so much buddy, means a lot 🎉

[Arjun Joshi](https://hashnode.com/@arjun2008)

[Sep 19, 2021](https://hashnode.com/posts/20-killer-javascript-one-liners/6146f17da2b54e17a52c38b6/comment/6146fc1e699fe76cd3482473)

Nice blog bro.

Plus I love this page's light theme more than the dark one.

[Savio Martin](https://hashnode.com/@saviomartin)

[Sep 20, 2021](https://hashnode.com/posts/20-killer-javascript-one-liners/6146f17da2b54e17a52c38b6/comment/6146fc1e699fe76cd3482473#reply-6147fc4217da986cea646d0d)

Thank you mate. Same for me, I love this site's light theme more. I should work more on the dark theme.

[Arjun Joshi](https://hashnode.com/@arjun2008)

[Sep 20, 2021](https://hashnode.com/posts/20-killer-javascript-one-liners/6146f17da2b54e17a52c38b6/comment/6146fc1e699fe76cd3482473#reply-6147fedc699fe76cd34838d9)

[Savio Martin](https://hashnode.com/@saviomartin) You could try using the darker shades of the colours you have used for the light theme.
