[a / b / c / d / e / f / g / gif / h / hr / k / m / o / p / s / t / u / v / vg / vm / vmg / vr / vrpg / vst / w / wg] [i / ic] [r9k / s4s / vip] [cm / hm / lgbt / y] [3 / aco / adv / an / bant / biz / cgl / ck / co / diy / fa / fit / gd / hc / his / int / jp / lit / mlp / mu / n / news / out / po / pol / pw / qst / sci / soc / sp / tg / toy / trv / tv / vp / vt / wsg / wsr / x / xs] [Settings] [Search] [Mobile] [Home]
Board
Settings Mobile Home
/g/ - Technology


Thread archived.
You cannot reply anymore.


[Advertise on 4chan]


File: chrome_QXGFAUuk2B.png (150 KB, 639x294)
150 KB PNG
wat.
>>
>>109611451
>vibenigger also can’t understand basic self-explanatory sentences
>>
luddites are trying so hard it's unreal
>>
>js
I would turn 360 and walk away
>>
>>109611482
*moonwalk away
>>
File: file.png (3.24 MB, 2816x1536)
3.24 MB PNG
>>109611479
the spamming will continue until the west is driven to literally bomb their own datacenters
>>
>>109611451
Looks like lambda expression to me.
>>
>>109611482
You'll be dead by then and/ or twisted
>>
File: 1768913585738875.png (183 KB, 528x438)
183 KB PNG
>>109611451
I asked ChatGPT to explain it to me and I still don't get it. I mean, it feels pointless.
>>
Immediately invoked anonymous function
>>
>>109611451
It's just a code block with extra steps
>>
I know what it is and I don't even use JavaScript.
>>
>>109611479
refusing to learn how to program is the literal and actual definition of being a luddite
>>
File: 1761433886696285.jpg (117 KB, 746x1063)
117 KB JPG
gemini found out first time so vibe coders will do fine.
>>
>>109611451
`(() => {})();` is JavaScript syntax for an **immediately invoked arrow function expression** (IIFE).

Breakdown:

```js
(() => {})();
```

- `() => {}` creates an arrow function with no parameters and an empty body.
- The outer parentheses make it a function expression rather than a declaration.
- The final `()` calls the function immediately.

It is equivalent to:

```js
(function () {})();
```

Since the function body is empty, this code does nothing observable. A useful version might be:

```js
(() => {
console.log("Runs immediately");
})();
```
>>
>>109611518
it's just a function. JS people just love to fuck up the syntax for no apparent reason
>>
>>109611518
the code as written is pointless, it does nothing
>>109611801
i understand these but they are niggerlicious
>>
>>109611487
>moonwalk
>walk
360 degrees and walk away
>>
>>109611451
First thing it makes me think of is :(){ :|:& };:
>>
>>109611487
>>109611820
so crazy to me that newfags are still THIS retarded after all these years. They don't even know what it means to turn 360 degrees
>>
File: images.jpg (30 KB, 588x330)
30 KB JPG
>>109611820
You'd walk away into that javashit job dumbass, you do a 360 and moonwalk away to a place that isn't as niggerlicious, one that preferably has TempleOS enjoyers.
>>
>>109611492
These posts glow so hard it’s unreal
Maybe Chinese people just feel more positive because they have more lower skilled opportunities and more manual work? Maybe because they don’t have jews bragging about how they’re going to make everyone unemployed and poor? No, must be the literal glownigger narrative.
>>
>>109611860
Yeah it's because everything important in China is state controlled so the Chinese know AI won't be used just for private profits.
But then they're already used to being datamined and monitored, so this isn't even a concern to them, because it always seemed normal to live in a surveillance society
>>
this is a bait post of the form "takes a beginner level knowledge to recognize it" and then the reader is compelled to respond outraged "what the heck... thats so easy!!!!"

real twitter goy cattle shit getting outsmarted by a fucking indian of all things.

more than half the replies in this thread are probably OP though

thank you globalists for giving indians and other 60 iq races the internet. thank you so much. i love seeing stupid shit like this every minute of every day.
>>
File: 1779763385251111.jpg (28 KB, 295x360)
28 KB JPG
>>109611492
>>
File: 1785982835753271.png (488 KB, 720x980)
488 KB PNG
>>109611451
Who the fuck doesn't use lambdas? You can only write bloated spaghetti code without lambdas.
>>
>>109611451
Doesn't work anymore
>>
>>109611805
retard
>>
>>109611518
It literally corresponds to calling a function with no arguments.
>>
File: IMG_0538.jpg (29 KB, 474x594)
29 KB JPG
>>109611482
You can do that but you'll have to turn around first
>>
>>109611451
it's literally just a function that's invoked as soon as it's created, js made it retarded on purpose because their lexical scoping rules is absolute fucking garbage
>>
it's pretty simple, it's syntax error
>>
javascript was a mistake
>>
This make perfect sense and I don’t even know javascript all of you are low iq morons
>>
>>109611479
Yes, luddites are seething and shitting their pants
We vibeGODS won
>>
>>109611451
>>109611518
this twitter bitch is retarded because nobody uses it anymore, this is old javascript shit and nobody would ask this in an interview. what a whore
>>
>>109612998
ai;dr
>>
>>109611451
arrow function
>>
File: nice.jpg (136 KB, 750x543)
136 KB JPG
>>109611451
  f => (x => x(x))(y => f(x => y(y)(x)));
>>
How much time are you really saving with this weird-looking, botched syntax?
>>
I guess the correct answer is "it's a IIFE"
https://developer.mozilla.org/en-US/docs/Glossary/IIFE
>>
Btw this obnoxious tweet is how C programmers sound too. C is a language that has similarly meaningless language constructs that exist only to gatekeep arbitrary knowledge. Since programming to a certain subset of "people" is just the act of signaling shared knowledge of garbage self-obfuscating antipatterns.
>>
File: 1582577728241.gif (103 KB, 500x355)
103 KB GIF
>>109613733
>orange reddit
>>
>>109611451
I don't use JavaScript nearly as much as other languages, but I want to say this is

1. An anonymous function, which takes no input and returns an empty object
2. Which is subsequently invoked
>>
>>109614067
It's mostly for passing to functions that take other functions as input. Like if you need to map or reduce an array.
>>
I use this notation quite often for encapsulating shit when I don't feel like going full OOP retard or writing a module:

const myFunc = (() => {
// internal state variables and helper functions defined here...
return (args) => {
// ...and used and/or mutated here
}
})();
[\code]

What you get a single `myFunc` function with internal state that persists across calls (but can't be accessed or mutated from the outside), and with no retarded `this` context headaches.
>>
>>109611451
A close that does nothing but is immediately called?
>>
>>109614415
can you show a simple didactical example? pl0x
>>
>>109612331
>picrel
idgi
>>
>>109611492
You're talking about a country that made Winnie the poo memes illegal and wielded their own citizens into their own apartments during covid. Speaking out against the CCP in China gets your organs harvested for chinese elite. Trusting china's public opinion is the most laughable thing I've heard all day.
>>
>>109611451
I will never use that modern slop syntax
function sovl(){
}
>>
>>109614415
securitard
>>
>>109611451
wat
>>
iife
the only practical thing I've ever used these for was for putting big multi line functions as scripts in the dev console
>>
>>109611801
>World's smartest vibe coder
>>
anonymous self-executing function? I don't know how I'd describe it because I never learned js the "formal" way
>>
>>109615017
no. see >>109611801
it's Immediately Invoked Function Expression (IIFE)
ai know better than you,lel.
>>
>>109615117
my knowledge of how it works in practice is enough, no need for names
>>
>>109615122
you know no shit. a self executing function is a recursive one.
>>
>>109611518
You create a function. But to run a function you need to call it. But the function is anonymous so you could not call it on its own, as anonymous functions are usually called inside of other expressions. But there you call it without it being inside an expression. So you put brackets around it and brackets after it. So it just on the spot runs what ever is inside {} with the parameter what ever you put inside ().
>>
File: fd1[1].gif (46 KB, 300x200)
46 KB GIF
>>109611830
>>109611820
>implying I'm a newfag
>implying I haven't seen that meme a million times
>>
>>109614706
Just turn it upside down. Pro tip: The blue isn't the sky, it's water
>>
>>109614067
none, theres no reason to use it in current year
no one writes raw ass javascript anymore, they'll use things like react and nextjs and theres no need for it there
>>
>>109611482
That doesnt even make sense
>>
>>109611492
>China numba 1
Anon, I...
>>
>>109611451
How often is this used in the real world where money is made?
>>
>>109611451
douglas crockford calls it "dog balls".
>>
>>109611451
Hello figital avatar from google here to assure you that all higher up staff are definitely still alive. You just not good enough to join google is all.

We just can't fire preexisting employees even though they aren't making our company profitable for shareholders. Also we need to increase our liabilities so we can outsource necessary tech!
>>
>>109611487
lurk for 5 years before posting
>>
>>109612999
what JSniggers use nowadays that is beyond the almighty lambda?
>>
File: 1758770548346172.png (22 KB, 803x487)
22 KB PNG
>>109611451
swiftGODs win again
>>
>>109612316
>corresponds to calling a function with no arguments.
no, it declares a lambda function with no arguments first before calling it. dependig on the language (I don't know what language that is), the interpreter may very well spend time constructing the lambda function and call it rather than skipping the whole thing
>>
>>109611827
it's not a fork bomb?
>>
>>109617715
>lambda function
not a real thing
>>
>>109614623
>>
>>109612289
Guido hates lambdas so the lambda keyword in Python is mega-nerfed and only usable for basic shit
>>
>>109618038
Retard
>>
>>109612998
AI won, not vibeshitter
>>
>>109618038
it has a memory address
it has a size
it is real to me
>>
File: real_stack_frame.jpg (63 KB, 708x486)
63 KB JPG
>>109618678
and in python, if you do
import pdb
pdb.set_trace()
(lambda: None)()

you get a real declaration followed by a real call with a real stack frame
>>
>>109611451
Only useful to assign a complexly computed value to a const.
>>
>>109611808
You're missing half the point you vibe-coding zoomie
>>
you can literally just tell claude to run that for you and explain what is does

>>109614067
during the stone age when every webshitter was LARPing as 1337h4xx0r with vim, they didnt use IDEs and so had to handwrite every single piece of code.

99% of cases its better to just use function expressions anyway. statements are nigger-coded
>>
>>109611808
it's not just a function retard it is a closure
>>
>scroll through thread
>not a single one of you dorks grokked that it's a penis entering a vagina
Come on, row. Surely the stereotype isn't THAT accurate?
>>
>>109611479
It's clearly engagement bait
>AI profile pic
>Building AI agents
>>
>>109618212
That's just global variables with extra steps
>>
File: 1757202123494013.png (23 KB, 598x569)
23 KB PNG
>>109620211
Every single time.
>>
>>109618971
>closure
what kind?
Addition? Superposition?
Upper or lower?

I don't know jeetscript but this just sounds like poojeet nonsense and cope for pulling the classic devshitter move of giving normal things bad snowflake names
>>
>>109620237
'Vibe coders' are really just Indian nocoders screaming a word they don't understand (luddites).
>>
>>109618716
>pytroon
>>
>>109620221
>local state is just global state with extra steps that make it the exact fucking opposite of global
Yes.
>>
>>109620462
I'm not Indian, just retarded.
Legally Indian I guess.
>>
Looks like a trollish way to write a NOP. JS brain damage might make it more than that IDK.
>>
>>109620372
it is an anonymous function being called, they say it's private or something idk, securitard stuff
>>
>>109620372
nobody knows or cares about the jargon of whatever nocoder field you crawled out of. it's a closure (programming).
>>109620221
>shared references are global variables
/g/ really is 90% full of 15 year olds who just did their first hello world isn't it
>>
File: two_stack_frames.png (70 KB, 1323x507)
70 KB PNG
>>109621360
it's not a NOP. see >>109618716 or picrel
>>
>>109622567
Is there a reason it's not optimized out? That's exactly what I mean by JS brain damage.
>>
>>109611451
So would I. That looks like some gay anonymous function crap that'd make the codebase a pain in the ass to actually debug.
>>
>>109614941
glows
>>
In D it's just
(() {})();

Or better:
(){}();


This form has some purpose, for instance returning from a static foreach iteration.
>>
>>109611451
deltarune reference????
>>
>>109623722
Should note that the Javascript function isn't returning nothing. It is very explicitly returning the empty object {}. The equivalent code in any other language should be returning a hash table with no elements.
>>
>>109625729
It doesn't return an empty object, it just runs nothing.
>>
>>109611479
just answer the question slopcoder
>>
>>109625729
No.
>>109625778
Technically, it returns undefined.

Also, most of you faggots ITT miss the point of the supposed interview question. The question isn't: "explain this cluster of empty parentheses", the question is: "when and why would you want to invoke an anonymous function immediately after defining it?".
>>
Honestly assigning the lambda to a variable and invoking the variable is nicer to read and gives some context for the purpose of the lambda.
>>
>>109625729
no you retard that is opening and closing brace of a function, its not an object
>>
File: 1774699025799686.png (45 KB, 929x464)
45 KB PNG
>>109614415
>>
>>109626115
>no IdGeneratorFactory
Not enough bureaucracy. Good effort, though.
>>
>>109625964
Yeah it is undefined, because it is a void function. Technically it returns nothing.
>>
>>109627657
>is undefined
"Being undefined" and returning an actual, primitive value of `undefined` described in the language spec are two different things. TECHNICALLY, every function call evaluates to a value.
>>
>>109625964
>when and why would you want to invoke an anonymous function immediately after defining it?
never, its a degenerate pattern and i wouldnt use it
>>
>>109625964
I've mostly used anonymous functions like that for implementing recursive operations inside a function so I don't have to actually figure out a name to call the thing. I write primarily C++ and typically wrap the whole thing in an anonymous struct so it's easier if I need to refactor later.
>>
>>109611451
This syntax is mental illness anyway.
>>
>>109611451
the pajeetism is off the charts
>>
Balls, dick into the vagina. The asshole is also drawn near the vagina.

The answer is sex.
>>
File: EsVM4UuXMAMKxmQ.jpg (17 KB, 314x251)
17 KB JPG
>>109611451
I have to look it up because it's not a thing in C++
>>
>>109616564
Go away newfag. Lurk another 20years.
>>
>>109611451
the function of a list is equivalent to or greater than its dictionary comma re-usuable code.
>>
>>109615117
Why are you larping as a SEA monkey lol
>>
>>109628229
How else would you write it?
>>
>>109630651
The C++ equivalent is even shorter:

[]{}()
>>
File: 1767085839539277.gif (80 KB, 500x500)
80 KB GIF
>>109630787
>still mad
bro, that was two days ago. chill.
>>
>>109611451
What's the question? It's obviously typescript.
>>
>>109611451
I see this all the time working with typescript.
>>
>>109620221
Its not
The mutuation is controlled
>>
>>109611479
>the new buzzword used by simpletons, losers and sex offenders isn't working
Sad!
>>
>>109614126
C is one of the easier languages to learn. You fell for the meme.
>muh antipatterns
There is such a thing as idiomatic C you dunce



[Advertise on 4chan]

Delete Post: [File Only] Style:
[Disable Mobile View / Use Desktop Site]

[Enable Mobile View / Use Mobile Site]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.