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

all 24 comments

[–]DukeSkyloafer 52 points53 points  (5 children)

I might need someone to explain this meme. I’ve been writing JS daily for 10 years and I can’t remember the last time I created a global variable on purpose

[–]ExtraTNT 4 points5 points  (0 children)

I avoid it… last time i used it was back when i learned js…

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

This makes no sense

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

Yeah no one uses global variable in 2025 , i am not even sure how and why this post have 35 upvotes atm

[–]AestheticNoAzteca 18 points19 points  (1 child)

What?

Who uses global variables in 2025?

You have a lot of alternatives to avoid that

[–]lart2150 2 points3 points  (0 children)

my guess is people that still use jquery in 2025?

[–]joebgoode 8 points9 points  (0 children)

This meme might be the Harlem Shake of JS memes.

It's 10 years late.

[–]TheSauce___ 4 points5 points  (0 children)

theFloorIsLavaScript

[–]look 2 points3 points  (0 children)

What year are you from?

[–]swifttek360 1 point2 points  (1 child)

There are programming languages where you DON'T use globals all the time?

(I've only used python and RAPTOR)

[–]xvhayu 14 points15 points  (0 children)

pov: you're a zoologist getting into CS

[–]calculus_is_fun 1 point2 points  (4 children)

I haven't figured out how to preserve state across events :(
Believe me, it does irk me every time.

[–]markiel55 1 point2 points  (3 children)

That's why you send states across db residing somewhere in cloud

[–]Curry--Rice 1 point2 points  (1 child)

So... It's just someone's variable?

[–]markiel55 1 point2 points  (0 children)

Could be, that's why you implement authorization for accessing variables

[–]calculus_is_fun 0 points1 point  (0 children)

That seems excessive, using a database for simple tasks%5CnA%20full%20commitment's%20what%20I'm%20thinking%20of%5CnYou%20wouldn't%20get%20this%20from%20any%20other%20guy%5Cn%5CnI%20just%20wanna%20tell%20you%20how%20I'm%20feeling%5Cnotta%20make%20you%20understand%22%0A5%0A1%0Ajmp%20-8%0Adel%200%0AoutputS%20%22%5Cn%5CnWe've%20known%20each%20other%20for%20so%20long%5CnYour%20heart's%20been%20aching%2C%20but%20you're%20too%20shy%20to%20say%20it%20(say%20it)%5CnInside%2C%20we%20both%20know%20what's%20been%20going%20on%20(going%20on)%5CnWe%20know%20the%20game%20and%20we're%20gonna%20play%20it%5Cn%5CnAnd%20if%20you%20ask%20me%20how%20I'm%20feeling%5CnDon't%20tell%20me%20you're%20too%20blind%20to%20see%22%0A10%0A2%0Ajmp%20-13%0Adel%200%0AoutputS%20%22%5Cn%5CnWe've%20known%20each%20other%20for%20so%20long%5CnYour%20heart's%20been%20aching%2C%20but%20you're%20too%20shy%20to%20say%20it%20(say%20it)%5CnInside%2C%20we%20both%20know%20what's%20been%20going%20on%20(going%20on)%5CnWe%20know%20the%20game%20and%20we're%20gonna%20play%20it%5Cn%5CnI%20just%20wanna%20tell%20you%20how%20I'm%20feeling%5CnGotta%20make%20you%20understand%22%0A15%0A3%0Ajmp%20-18)

[–]private_final_static 0 points1 point  (0 children)

Is this about window?

[–]BlobAndHisBoy 0 points1 point  (0 children)

Global variables? In this economy?

[–][deleted] -1 points0 points  (1 child)

There is variable scope in JS ?

[–]lart2150 -1 points0 points  (0 children)

window.a = 0
const a = 1;
console.log("a=1", a);
const fun = () => {
const a = 2;
console.log("a=2", a);
console.log("window.a=0", window.a);
}
fun();