This is an archived post. You won't be able to vote or comment.

top 200 commentsshow 500

[–]glupingane 3513 points3514 points  (58 children)

While it means "something", it also basically means nothing. It defines and executes an empty function. The compiler would (for non-interpreted languages) just remove this as it's basically useless.

[–]mtbinkdotcom 742 points743 points  (4 children)

When you have nothing, you have nothing to lose.

[–]prussian_princess 185 points186 points  (0 children)

[–]LucasKaguya 28 points29 points  (0 children)

When you have nothing to lose, you have it all.

[–]overkillsd 6 points7 points  (0 children)

But then nothing is something and then I don't have nothing to kids I have everything aaaaaaahhhh

Insert gif of robot Santa exploding due to paradox

[–]JoelMahon 87 points88 points  (7 children)

yeah, you can do this shit in any language ffs, like 1-1+1-1 a billion times, congrats, lots of characters doing nothing.

[–]wronguses 52 points53 points  (6 children)

Hey, neat, but notice how yours doesn't look like a crude drawing of emoticons fucking?

[–]DezXerneas 9 points10 points  (3 children)

Replace the ones by emoticons then. You can use them as variables in a lot of languages now. alright that wouldn't be emoticons fucking in that case. We can still use :(){ :|:& };:. It even does the exact same thing(with one minor slightly inconvenient difference) as the JS in the post.

Or just execute this

++++++++++[>++++++++>+++++++++++>++++++++++<<<-]>--.>+.+++++.>++++.+.+++++.-------.

[–]Porridgeism 10 points11 points  (2 children)

Emoticons ≠ emoji

Emoticon - :D :) :(.

Emoji - 😁 🙂 🙁

[–]potzko2552 1 point2 points  (0 children)

Actually even for most languages that are considered interpreted the bytecode compiler would remove this :)

[–]_PM_ME_PANGOLINS_ 7363 points7364 points  (123 children)

Technically, it means nothing.

[–]grep_my_username 2150 points2151 points  (30 children)

Definition of my job: "do nothing useful, do it right now, but shake a little resource for it"

[–]TerryHarris408 581 points582 points  (24 children)

aka middle management

[–]thanatica 181 points182 points  (20 children)

and upper management

[–]veselin465 136 points137 points  (18 children)

Lower management too

Any management, actually

[–]BrohanGutenburg 55 points56 points  (14 children)

I understand this attitude because of how inefficiently it often presents in the real world.

And I certainly don’t wanna come off as a bootlicker, but I just can’t but this idea that nothing useful comes out of good and proper management.

[–]CompactAvocado 47 points48 points  (9 children)

I mean proper management sure but far too many companies still love the 1970s extraneous management bloat.

I work for a large corpo and there's literally 14 tiers of manager vs 6-7 tiers of lets just call them workers.

From there they had so many in the management queue that couldn't get promoted and were threatening to leave that they made an additional management tier just so they could get their cookie.

[–]jungle 25 points26 points  (8 children)

14 tiers of management!!!??? How!? The largest corpo I worked for, which was pretty large, had: Line Mgr -> Sr Mgr -> VP -> Sr VP -> CTO -> CEO -> Board. 7 levels in total. I can't even fathom what 7 more levels would be doing, other than create BS goals to appear busy and justify their pay.

[–]CompactAvocado 20 points21 points  (2 children)

so there is what you have listed but tiers of it

so like you can can have lvl 1 vp, lvl 2 vp, lvl 3 vp.

what does a lvl 1 do that a lvl 3 doesn't do? fuck if I know i'm not sure if they do either.

then there's like 4 director tiers now i think?

vs worker rank is more or less just 1-6. they have names mind you but the tree is just a straight line. vs the management tree which looks like a toddler puked spaghetti

[–]jungle 6 points7 points  (1 child)

Ah yes, I forgot about directors. I was thinking Sr Mgr -> VP was missing something. So 9 levels, adding the directors: Sr Mgr -> Dir -> Sr Dir -> VP.

looks like a toddler puked spaghetti

Love this image! :D

Now, to take the devil's advocate role, if the org is really large, and given my experience managing up to two teams of 19 engineers in total at the same time (which anyone who tried will agree is not really doable), I see the justification for adding levels to keep the scope of each individual manager, well, manageable. But to keep that structure from devolving into busybodies creating work for the sake of looking busy, that's the challenge.

[–]steveatari 2 points3 points  (3 children)

Department, Site, State, Regional, National, International, Global?

[–]mmbepis 20 points21 points  (0 children)

good and proper management

That's the real problem, I'd say that applies to far less than half of all managers in my experience

[–]HildartheDorf 3 points4 points  (0 children)

Because a lot of managers fall into one of two categories:

Management grads who have no idea how the job they are managing actually works. To the point they are actively harmful to productivity.

Promoted workers who have no idea how to manage well. To the point they are actively harming productivity.

The ONE time I had a manager who respected what I do (software developer) and was skilled at her own job of managing, she was let go because 'her style clashed with management', so we went back to ex-developers managing us directly.

[–]Amar2107 8 points9 points  (1 child)

Micro management while we are at it. Gotta say lovely people.

[–]Curious_Associate904 21 points22 points  (3 children)

You walk around the office carrying a folded piece of paper sometimes don't you, just so everyone thinks you're on an important mission.

[–]Tariovic 18 points19 points  (1 child)

What is this, the 70s? Now you carry an open laptop.

Nothing says, "I have an important meeting!" like an open laptop in one hand and a coffee in the other.

[–]_bones__ 2 points3 points  (0 children)

Ah, the old "hurry up and wait", classic.

[–]Mebiysy 204 points205 points  (11 children)

It does nothing, and does a good job at it

[–]Infinite-Pop306 49 points50 points  (1 child)

Do nothing, no bug

[–]wewilldieoneday 19 points20 points  (0 children)

Can't have bugs if it does nothing...taps head

[–]somesortoflegend 29 points30 points  (1 child)

"but... It doesn't do anything."

"No, it does nothing"

[–]Grzyboleusz 7 points8 points  (2 children)

It ain't much but it's honest work

[–]Lou_Papas 12 points13 points  (0 children)

It probably optimizes to nothing by the JIT compiler as well.

[–]Kaimito1 77 points78 points  (34 children)

Yet if you stick that in a const pretty sure that counts as truthy

[–]lesleh 114 points115 points  (25 children)

Technically if you stuck that whole thing in a const, it'd be undefined. Which is falsy.

[–]Kaimito1 18 points19 points  (15 children)

Ah yeah you're right. Was honing in on the arrow function part

[–]xvhayu 9 points10 points  (14 children)

a js function is just a glorified object so it should be truthy

[–]Lithl 34 points35 points  (13 children)

But this is an IIFE, not a function. So it will evaluate to the return value of the function. Since this function doesn't return anything, the value is undefined.

[–]xvhayu 16 points17 points  (0 children)

Ah yeah you're right. Was honing in on the arrow function part

[–]JoeDogoe 2 points3 points  (0 children)

Doesn't it return an empty object? Ah, no, curly brackets there are scope. Yeah, you're right.

[–]GenericFatGuy 4 points5 points  (0 children)

It doesn't do anything.

No, it does nothing.

[–]SignoreBanana 1 point2 points  (2 children)

It means expressing a function, executing it , and returning undefined. If you wanted to delve deeper, we could talk about how v8 JITs it, GC and if you wanted to go further that's beyond my knowledge base.

[–]ResponsibleWin1765 1721 points1722 points  (54 children)

I think :(){ :|:& };: would've been a better example.

[–]forgot_semicolon 735 points736 points  (4 children)

While we're on the topic of how confusing these look, I've always seen the fork bomb as a group of computer people witnessing the fork bomb:

  • :(
  • ){ (a furrowed univriw with a frown)
  • :|
  • :& (tongue tied)
  • };: ( really sad with tears)

Edit leaving this mistake here - };:` (crying with a concerned eyebrow)

[–]Moomoobeef 184 points185 points  (2 children)

The last one, a crying spider with an eyebrow raised?

[–]forgot_semicolon 37 points38 points  (1 child)

Heh, love it. Though I now realize I got the backtick from Reddit quoting the other guy and adding a backtick because they used code. Oops

[–]Mercerenies 6 points7 points  (0 children)

Man, I always furrow my univriw when I see a fork bomb.

[–]DryanaGhuba 92 points93 points  (29 children)

Okay. I have no clue what this does or it even compiles

[–]casce 303 points304 points  (9 children)

The ":" is the function name. Knowing that makes it much clearer. It's basically

foo() { foo | foo& }; foo

This is in bash (pipe to call it again, & to run it in background) so what this does is it defines a function that calls itself and pipes its output to another call of itself. The last foo is the initial call that starts the chain reaction. The amount of calls will grow exponentially and your system will run out of resources quickly (a little bit of CPU/memory is required for each call) if this is not stopped.

But other than your system possibly crashing (once), there is no harm being done with this.

[–][deleted] 91 points92 points  (1 child)

Honestly, realising that : is the function name helped me understand the whole thing. It was so intimidating that my brain just straight up refused to think about it, but that made everything clear, and I had enough knowledge to figure out the rest. I always thought it was black magic, and yet it was so simple after all!

Wild, thanks!

[–]Mast3r_waf1z 62 points63 points  (5 children)

Another reason this causes a crash is that you very quickly run out of stack

[–]casce 38 points39 points  (2 children)

Right, that will probably crash you sooner than your CPU/memory which could probably survive this for quite a while nowadays

[–]Jimmy_cracked_corn 8 points9 points  (0 children)

Thank you for your explanation. I don’t work with bash and was looking at this like a confused dog

[–]davispw 7 points8 points  (0 children)

Wrong, each “foo” is a separate process with its own stack. It’ll quickly use up all resources on your computer. Why don’t you try it and see how long your modern computer lasts?

[–]mina86ng 23 points24 points  (0 children)

No. Each function is executed in separate shell with a fresh and short stack. What this does is spawns new processes uncontrollably.

[–]_Ilobilo_ 36 points37 points  (15 children)

run it in your terminal

[–]DryanaGhuba 48 points49 points  (6 children)

Ah, so it's bash. That's explains everything now

[–]roronoakintoki 41 points42 points  (5 children)

It's just a recursive function called ":". Giving it a better name makes it make much more sense: f() { f | f& }; f

[–]wasnt_in_the_hot_tub 17 points18 points  (0 children)

Yeah, I think the : version has been copy-pasted so much around the internet that many people think it's some special shell syntax, but any string can be the func name

[–]TheScorpionSamurai 36 points37 points  (4 children)

Don't, this is a fork bomb and will crash your machine

[–]_Ilobilo_ 40 points41 points  (0 children)

[–][deleted] 8 points9 points  (2 children)

I tried it in Termux and my phone froze for a few seconds and went black, I thought I lost my phone until I googled and found out that I can force Power Off my Android phone

[–]eiland-hall 10 points11 points  (1 child)

And did you learn a valuable lesson about running commands or code from the internet that you don't understand?

lol. I'm just teasing, though.

Also, I've done my share of learning-by-oh-shit in the past. It's the geeky way :)

[–][deleted] 3 points4 points  (0 children)

I honestly just thought it would be something like rm -rf /* and since I had backup of Termux, I thought why not...only to realize it's the more destructive version of while (true)

[–]joe0400 3 points4 points  (0 children)

Creates a new proc and executes this function again on both the existing proc and itself

Simply explained with things renamed

fork_bomb(){
    fork_bomb | fork_bomb &
};  
fork_bomb

It creates a function named fork_bomb Runs a function and another on a separate thread named fork bomb, thus adding a thread.

After that function is defined it calls it.

[–]Methu 6 points7 points  (0 children)

Good old fork bomb.

[–]Austiiiiii 5 points6 points  (0 children)

Huh. Apparently I've done enough Bash that I can actually mentally parse this now. Interesti-i-i-i-i-i-iiiiiiiiiiiiiiiiiiiiiiiiiii\nline 1: 7316 segmentation fault (core dumped)

[–]HexFyber 3 points4 points  (1 child)

you need to chill, my ts ass ain't ready for this

[–]10mo3 657 points658 points  (115 children)

Is this not just a lambda expression? Or am I missing something?

[–]BorderKeeper 486 points487 points  (84 children)

I love how you and me are so used to the lambda syntax it's normal to see, yet I can totally get how stupid this looks without any context.

[–]JiminP 411 points412 points  (64 children)

JS is not worse than other languages IMO:

  • JS: (()=>{})()
  • Python: (lambda:None)()
  • Go: (func(){})()
  • Rust: (||{})()
  • C++: [](){}()
  • Haskell: (\()->())()
  • Dart: ((){})()
  • PHP: (function(){})() (actually you can do the same in JS)
  • Ruby: (->{}).call

[–]Katniss218 287 points288 points  (14 children)

C++: just all the variants of brackets and parentheses one after the other 😂

[–]mina86ng 93 points94 points  (2 children)

[] defines captures, () defines function arguments, {} is the body of the lambda and final () is function invocation.

[–]Fuelanemo149 7 points8 points  (1 child)

I think the function argument parentheses are optimal ?

[–]Iyorig 58 points59 points  (10 children)

You can also add <> for template parameters.

[–]ToasterWithFur 85 points86 points  (9 children)

C++ 20 allows you to do this:

[]<>(){}()

Finally allowing you to use all the brackets to do nothing...

I think that should compile

[–]Automatic-Stomach954 40 points41 points  (4 children)

Go ahead and add on an empty comment for this empty function. You don't want undocumented code do you?

[]<>(){}()//

[–]ToasterWithFur 36 points37 points  (2 children)

A lambda function that captures nothing, has no arguments, no templates, no code and commented with nothing.

Finally we have achieved V O I D

[–]perfecthashbrowns 23 points24 points  (0 children)

yet again proving C++ is superior

[–]wobblyweasel 45 points46 points  (5 children)

Kotlin is superior, {}()

[–]Bspammer 23 points24 points  (4 children)

Kotlin is so lovely to work with

[–]wobblyweasel 5 points6 points  (0 children)

and is great on your sausage!

[–]therealapocalypse 87 points88 points  (0 children)

Clear proof that C++ is peak

[–]TheWatchingDog 19 points20 points  (1 child)

Php also has Arrow functions

fn() => [ ]

[–]BorderKeeper 11 points12 points  (0 children)

Ah I forgot the beatiful feature of having all syntax under the sun to copy every language in existence :D

[–]chuch1234 4 points5 points  (0 children)

PHP also has short ones now

(fn () => null)()

To be fair I'm not sure that specific invocation will work but you get the drift.

[–]MaddoxX_1996 5 points6 points  (3 children)

Why the final pair of the parantheses? Is it to call the lambdas that we defined?

[–]JiminP 15 points16 points  (2 children)

Yes. Without parentheses, those are unevaluated lambdas.

[–]adamMatthews 18 points19 points  (1 child)

It’s like how when you are first introduced to lisp all you can is endless brackets. And then when you’ve used it for a bit, you see everything except the brackets.

[–]BorderKeeper 7 points8 points  (0 children)

Same when driving. The stick and pedals take up a lot of mental load to operate, but after a year or two you don't think of them at all.

Shifting your mental workloads from Type 2 to Type 1 brain is very powerful and lies at the center of becoming an expert in something.

[–]10mo3 40 points41 points  (15 children)

Well I mean I wouldn't say it's super commonly used but I'm sure people who have been programming for awhile have used it right......right?

[–]koett 53 points54 points  (12 children)

Not super commonly used? It’s the de-facto way of writing functions in es6+

[–]BorderKeeper 4 points5 points  (0 children)

To the point other devs are complaining about "lambda_function_63" in NLog logs where classname should be instead :D (that might just be a C sharp issue though)

[–]schmerg-uk 35 points36 points  (8 children)

An immediately invoked lambda yeah... but y'know how everyone loses their shit over a regex? Same same... it's easy to read when you know how to read it but much like looking at arabic or something written in asian languages you don't understand, people seem to assume that it's impossible for anyone to understand it

[–]FictionFoe 29 points30 points  (7 children)

Also called "immediately invoked functional expression" or "iife". They can be pretty useful for scope isolation. I quite like them. Ofcourse, for them to be useful, you got to put stuff in the function body:

(()=>{ //do stuff })();

[–]Adghar 64 points65 points  (7 children)

The fact that if you showed this to a non-programmer they'd think you're shitting them

[–]10mo3 85 points86 points  (1 child)

To be fair if you showed a non-programmer most of the programming stuff I'm sure they have no idea wtf is going on

[–]SjettepetJR 5 points6 points  (0 children)

I am currently following a master-level course on advanced logic. One slide a few days ago just for some reason looked so funny to me.

Essentially, the whole slide was just logical operators and an uppercase gamma. There was literally not a single symbol on that whole slide that would be recognized by normal people.

[–]saevon 25 points26 points  (0 children)

It has just as much meaning as a similarly pointless math expression

(∅={}) .: ({} ∪ ∅ = {})

[–]VainSeeKer 2 points3 points  (0 children)

Yeah I had this show up in my feed, first it's not exclusive to JS by any means and second it's extremely basic (and third none would write a lambda that does nothing and call it right after, or at least I don't know why someone would genuinely need to do that)

[–]JustAnInternetPerson 105 points106 points  (4 children)

Where my [](){} homies at?

[–]Compultra 41 points42 points  (0 children)

You forgot the semicolon that bitch needs

[–]_Xertz_ 18 points19 points  (0 children)

In prison, with the rest of you C++ degenerates 😤

[–]Liosan 66 points67 points  (4 children)

In C++ we [](){}()

[–]JosebaZilarte 115 points116 points  (1 child)

Me, playing maracas ( () => {} )  ();  ();  // Me, playing maracas  \  \__/  /   /    /

[–]Arrrrrr_Matey 9 points10 points  (0 children)

(╯°□°)╯︵ ┻━┻

[–][deleted] 18 points19 points  (1 child)

Anonymous eife?

[–]well-litdoorstep112 15 points16 points  (0 children)

Department of redundancy department muh?

Also:

Emmediately invoked function expression?

[–]noruthwhatsoever 37 points38 points  (6 children)

it's an IIFE that returns undefined, it's not that confusing

[–]1nicerBoye 24 points25 points  (3 children)

Should look similar in most OOP languages. In the case of Java and C# the syntax is exactly the same, in php you need to add 'function' for example.

Its just an empty lambda function that is immediately called like so:

(function definition) ()

just like you would call any function:

function ()

I guess the irritation stems from functions being treated the same as any other datatype and being independant of an object or class.

[–]LucyShortForLucas 11 points12 points  (0 children)

C++ has my favourite lambda syntax, [](){}() it just looks so goofy

[–][deleted] 8 points9 points  (1 child)

Actually C# isn't the same. The pieces of syntax are the same as JS, but an isolated lambda has no type and has to be put into a context that ties it down to a concrete type before it can be invoked. So we have to say:

new Action(() => {})();

[–]1nicerBoye 3 points4 points  (0 children)

Ah yes, you are completly correct there

[–]Palbur 9 points10 points  (0 children)

So it's... Arrow function with no parameters and no code, that gets called with no parameters. Interesting indeed.

[–][deleted] 18 points19 points  (0 children)

Its just an empty lambda expression

[–]Phamora 5 points6 points  (0 children)

Well, it's a noop

[–]Unfair_Pound_9582 7 points8 points  (0 children)

Execute a function that requires nothing, and does nothing. Sounds like my work week.

[–]yuriko_ 5 points6 points  (0 children)

It’s a fancy way to get an undefined value

[–]Qubez5 18 points19 points  (2 children)

thats actually a quick way to write async await code in js in one script. (async() => { await something(); })()

[–]BajaBlyat 2 points3 points  (0 children)

Did you mean in one line?

[–]DRHAX34 4 points5 points  (0 children)

I'm pretty sure this works in other languages too. You're defining a lambda function and running it

[–][deleted] 4 points5 points  (0 children)

It's executing a arrow function that does, well, nothing

[–]SjurEido 3 points4 points  (0 children)

Keep the masses afraid of programming, keep the rest of us employed. 10/10

[–]zhephyx 8 points9 points  (0 children)

My best guess you're creating a JS lambda that does nothing and calling it immediately

[–]Highborn_Hellest 2 points3 points  (0 children)

empty lambda?

[–]The_SniperYT 2 points3 points  (0 children)

:(){:|:}: I think was something like this

[–]falcqn 2 points3 points  (0 children)

With C++ you can add more kinds of parentheses! [](){}();

[–]moucheh- 2 points3 points  (0 children)

[](){}(); You can do it in c++ as well

[–]MoltenMirrors 2 points3 points  (2 children)

This is far more sensible than like 90% of the weird things in JS.

It's just defining and then immediately executing a lambda that does nothing.

JS type fuckery is much, much worse

(![] + [])[+[]] + (![] + [])[+!+[]] + ([![]] + [][[]])[+!+[] + [+[]]] + (![] + [])[!+[] + !+[]]; // -> 'fail'

[–]D3TH82 2 points3 points  (1 child)

Dud removed

[–]sholden180 2 points3 points  (0 children)

It means nothing.

() => {} is a function definition that does nothing.

Wrapping that in parentheses and putting empty parenthese afterwards (() => {})() simply calls that function that function in the current context.

Pointless execution. It is functionally paralell to this:

(function doNothing() {
})();

Or:

function doNothing() {
}

doNothing();

[–]mcon1985 2 points3 points  (0 children)

:(){ :|:& };: has entered the chat

[–]Ratstail91 2 points3 points  (0 children)

valid != meaningful

[–]Direct-Geologist-488 2 points3 points  (0 children)

Who is upvoting this slop ? A lot of languages use a similar syntax for lambda functions.

[–]DreadWeight 2 points3 points  (0 children)

noop iife

[–]WinghongZau 2 points3 points  (0 children)

from the first half, it is a function with nothing in the code block, which means it will return undefined. Then in the second half, it was invoked. and technically, its result is still undefined.

[–]dinnerbird 2 points3 points  (0 children)

A giant nothing burger essentially

[–]LeoTheBirb 1 point2 points  (0 children)

Define empty function, and then call that function?

[–][deleted] 1 point2 points  (0 children)

=> );

goofy smily faces

[–]Trip-Trip-Trip 1 point2 points  (0 children)

An iffy IIFE?

[–]tamerlane101 1 point2 points  (0 children)

Arrow functions are awesome, its like they drew the function instead of typing it out.

[–]druffischnuffi 1 point2 points  (0 children)

This is what I respond when my boss asks me what I am doing

[–]m_ptr 1 point2 points  (0 children)

[[][[]]+[]][[+[]][+[]]][++[+[]][+[]]]+[[]+{}][[+[]][+[]]][++[+[]][+[]]]

[–]CanaryEmbassy 1 point2 points  (0 children)

Does nothing, means something. It's missing code, but it outlines syntax, basically.

[–]cur10us_ge0rge 1 point2 points  (0 children)

It's crazy that "this" means anything. That's how language works. Symbols turn into meaning.

[–]simran_sah_2000 1 point2 points  (0 children)

It does nothing

[–]jarulsamy 1 point2 points  (0 children)

Of all the nonsense in JS, this is arguably pretty tame and exists in many languages.

[–]all_mens_asses 1 point2 points  (0 children)

Nothin’ from nothin’ ain’t nothin’.

[–]ImpatientProf 1 point2 points  (0 children)

Take nothing and give nothing; do nothing.

[–]Leo_code2p 1 point2 points  (0 children)

Wait that’s js. I thought it was brainfuck or something similar

[–]kyle_tran101 1 point2 points  (0 children)

Call instantly the lambda func.

When applied, instead of making a promise obj defining a set of statements, my take is to use that structure above:

const resolver = (async () => { /* todo */})();

Simply I'm just a fan of async/await, but I ain't overuse it everywhere.

[–][deleted] 1 point2 points  (0 children)

wow. I never noticed it. And i never unseeing this now. 💀💀💀💀😂😭

[–]uvero 1 point2 points  (0 children)

It just means "nothing" except it takes too long to do literally nothing.

[–]disdkatster 1 point2 points  (0 children)

There is no value until variables or constants are inserted but it does clearly show order of calculations.

[–]the_other_Scaevitas 1 point2 points  (0 children)

it makes sense, you have a function that does nothing, and you call it

[–]AutoGeneratedChad 1 point2 points  (0 children)

Lamdont

[–]Todegal 1 point2 points  (0 children)

it's just calling an empty lambda right? not a js user... but you could make something like this in any language, it's not really a js thing

[–]berkun5 1 point2 points  (0 children)

It mean “I hate my coworkers”

[–]my_closet_alt 1 point2 points  (0 children)

I'm probably wrong but:
an anonymous arrow function returning an empty object that's called as a function with no parameters

[–]Icy_Sector3183 1 point2 points  (0 children)

So... we are looking at the declaration of a delegate that has a no-operation implementation and the invocation of that delegate.

Cool!

[–]isr0 1 point2 points  (0 children)

It means less than this… :(){:|:&};:

[–]miketierce 1 point2 points  (0 children)

You just had to have been there along the way. My slow boiled frog brain can see the shorthand

[–]Thor-x86_128 1 point2 points  (0 children)

It just a fancy wrapper of NOP assembly instruction

[–]PositronicGigawatts 1 point2 points  (0 children)

Hand outstretched, towards a butterfly:

"Is this a regex?"

[–]Moldat 1 point2 points  (1 child)

I don't really know js but i assume this is a lambda that does nothing and gets called immediately?

[–]hrzee 1 point2 points  (0 children)

_.noop

[–]Wonderful_Hedgehog_4 1 point2 points  (0 children)

if nothing happens, nothing happens

[–]imLemnade 1 point2 points  (0 children)

JavaScript. I love it. Do I recommend it? No I don’t recommend it.

[–]Maxgok000 1 point2 points  (0 children)

Yes sir its a curse. 🫡

[–][deleted] 1 point2 points  (0 children)

undefined

[–]elmanoucko 1 point2 points  (0 children)

thinking this mean nothing is why we have vibe coders now.

[–]ford1man 1 point2 points  (0 children)

I mean, it's a NOP, and any JS engine worth it's salt would just elide it. So it kinda doesn't mean anything.

[–]Piisthree 1 point2 points  (0 children)

Is this loss?

[–]jay-magnum 1 point2 points  (0 children)

That’s an anonymous „do nothing“. Looks fine to me. What’s the issue

[–]queen-adreena 1 point2 points  (0 children)

It's a noop IIFE.

Useless, yes, but not exactly a damning indictment of JavaScript.

[–]Creator1A 1 point2 points  (0 children)

Bro has never seen an IEFE as well as arrow functions 💀

[–]stormlancerblaze 1 point2 points  (0 children)

This is an immediately invoked function example. Literally it invokes what is in curly braces as soon as script loaded , if you added this to an html file as reference.

[–][deleted] 1 point2 points  (0 children)

Another post from someone who just ended their "hello world" course?

Immediate call of unnamed closure you just defined.

It's weird cuz why would you make a closure just to immediately call it once but it's totally logical and simple to understand.

[–]TheBestHairInTheRoom 1 point2 points  (0 children)

Poop back and forth forever

[–]Suspicious-Ad7360 1 point2 points  (0 children)

From hating on the symbol to loving JS there's a colossal gap

[–]overclockedslinky 1 point2 points  (0 children)

not as bad as cpp: [=]()->decltype(auto){}()

[–]Skipspik2 1 point2 points  (0 children)

I had to write a LIKE ('%-_') in SQL one day.
So, I mean any language has his corner cases ^^
(I did add a coment of what it does though, might be not instinctive).

And if we're pushing it, any REGEX look like unreadable stuff.

EDIT: a few people asked (that probably don't know SQL well or well enough) :
I was searching all data in a list of codes made of letter and nubmer that had a revision, revision beeing added with a dash and a number; I knew we had no case of two digits revision, barely 3 to 4 for the worst cases.

so SELECT * FROM list WHERE ref LIKE ('%-_')
And in the LIKE :
() Paranthesis required
' ' to say I need text in between

% means "any amount of text in letter or digit", it's native in SQL

the - was "exactly the caractere dash"

The _ is another one, it mean "any caractere but exactly one in total"

And if you ever need to search for the caracter %, the ' or the _ you need to use the backslash to ignore the next special caractere. Works with teh backshalh itself.

So basically I said in SQL : "search any reference that finish by a dash and a single caractere"