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.

Why does ++[[]][+[]]+[+[]] return the string "10"?

32 pointsby downboots8 months ago

9 comments

paol8 months ago
This would have made a good addition to the (in)famous WAT talk:<p><a href="https:&#x2F;&#x2F;www.destroyallsoftware.com&#x2F;talks&#x2F;wat" rel="nofollow">https:&#x2F;&#x2F;www.destroyallsoftware.com&#x2F;talks&#x2F;wat</a>
评论 #41779383 未加载
评论 #41781446 未加载
fs_tab8 months ago
Another good one is (in python):<p>print(chr(sum(range(ord(min(str(not())))))))<p>&gt; ඞ<p>Source: <a href="https:&#x2F;&#x2F;x.com&#x2F;chordbug&#x2F;status&#x2F;1834642829919781369" rel="nofollow">https:&#x2F;&#x2F;x.com&#x2F;chordbug&#x2F;status&#x2F;1834642829919781369</a>
评论 #41799503 未加载
评论 #41779817 未加载
bugtodiffer8 months ago
Did you know we almost had a lisp style language in our browsers? But Sun&#x27;s marketing budget on &quot;Java&quot; made something that sounded similar (JavaScript) favored more<p>people wouldn&#x27;t have these weird questions if we had used good programming languages from the start, but marketing dollars changed this timeline forever and every new generation learns about wtf-js
评论 #41778221 未加载
评论 #41778397 未加载
评论 #41779017 未加载
评论 #41778506 未加载
评论 #41778297 未加载
评论 #41778279 未加载
评论 #41778505 未加载
K0balt8 months ago
<a href="https:&#x2F;&#x2F;github.com&#x2F;aemkei&#x2F;jsfuck">https:&#x2F;&#x2F;github.com&#x2F;aemkei&#x2F;jsfuck</a><p>Has anyone seen a transpiler for regular JS into jsfuck?<p>It would be like maxify-obscurify
keybored8 months ago
Everyone who tries `++[[]][+[]]+[+[]]` stumbles upon this. Who hasn’t?<p>I expected `8`. `10` left me in disbelief before I found the accepted answer on the question.
Aardwolf8 months ago
++[++[+[]][+[]]][+[]] outputs 2 as a Number (rather than as string). How high could we go with those 3 characters ([, ] and +, no spaces) with less-than-exponential scaling compared to amount of digits of the result, as Number (as string it&#x27;s easy by concatenating digits of course)?<p>I&#x27;m thinking it&#x27;s not possible without being able to use &#x27;*&#x27;
评论 #41778285 未加载
评论 #41778325 未加载
david-gpu8 months ago
I thought this was Brainfuck and was confused, as it contains an infinite loop right at the beginning.
Mr_Bees698 months ago
burn it. burn it all. flames shall devour our world of decadence and sin. we are no longer redeemable
draw_down8 months ago
&quot;10&quot; is a JavaScript error code, indicating &quot;this is JS, not Brainfuck&quot;
评论 #41778306 未加载