TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Ask HN: JavaScript tips and tricks

2 pointsby nodivbyzeroover 9 years ago
Hey hackers Let&#x27;s share your javascript tips &amp; tricks. For example:<p>~~2 === Math.floor(2); &#x2F;&#x2F; true

2 comments

lepprover 9 years ago
<p><pre><code> window.addEventListener(&quot;beforeunload&quot;, function () { alert(&quot;You just won our user lottery! Sign-up for a FREE iPad!&quot;); return false; }</code></pre>
lollipop25over 9 years ago
Array(3).fill(&#x27;ha&#x27;).join(&#x27;&#x27;);<p>Array(16).fill(&#x27;na&#x27;).join(&#x27; &#x27;) + &#x27; Batmaaan!!!&#x27;;