---
title: "Comment by Antonio Pekeljevic on \"20 Killer JavaScript One Liners ☝️\" | Hashnode"
description: "Good job, I really like the list! I have recently played with window.getSelection(); and if you are using it in an .addEventListener(&#39;click&#39;=&gt;{}); fu"
url: "https://hashnode.com/posts/20-killer-javascript-one-liners/6146f17da2b54e17a52c38b6/comment/614742bf699fe76cd3482ad5"
---

[Discussion](https://hashnode.com/posts/20-killer-javascript-one-liners/6146f17da2b54e17a52c38b6)

Comment [20 Killer JavaScript One Liners ☝️](https://hashnode.com/posts/20-killer-javascript-one-liners/6146f17da2b54e17a52c38b6)

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