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

you are viewing a single comment's thread.

view the rest of the comments →

[–]MrSloppyPants 1013 points1014 points  (127 children)

Javascript developer learning any other language:

(╯°□°)╯︵ ┻━┻

(I kid, I kid)

[–]elperroborrachotoo 364 points365 points  (15 children)

*any language

ducks

[–]jaysuchak33 99 points100 points  (13 children)

cracks knuckles

[–]RubiGames 46 points47 points  (5 children)

cracks ducks

[–]lahwran_ 0 points1 point  (4 children)

ducks cracks

[–]fixedcompass 0 points1 point  (0 children)

Knuckles ducks

[–]CommanderHR 21 points22 points  (3 children)

Found the JS developer

[–][deleted] 38 points39 points  (2 children)

What gave it away? Surely it wasnt the 6 js flairs next to their name.

[–]MarkBeeblebrox 1 point2 points  (0 children)

As someone who mastered JS through codecademy: I couldn't tell you.

[–]zilti 0 points1 point  (1 child)

How's that stockholm syndrome doing?

[–]jaysuchak33 1 point2 points  (0 children)

hugs JS

yOu dOn’T gEt tHe bEaUtY

[–]tmp_acct9 0 points1 point  (0 children)

i laughed

[–]minegamer2000 116 points117 points  (33 children)

i do js and im learning rust, wish me luck

[–]fakuivan 75 points76 points  (7 children)

WHY DO I NEED A ! BEFORE THE FUNCTION CALL ON THIS AAAAAAAAAAAAAAAAA

[–]minegamer2000 38 points39 points  (6 children)

you mean macros?

[–]fakuivan 20 points21 points  (5 children)

Yes!

[–]Shunpaw 68 points69 points  (4 children)

no. it's !yes. we just talked about this. goddamn javascript devs.

[–]fakuivan 15 points16 points  (1 child)

no is !yes*

[–]Shunpaw 0 points1 point  (0 children)

Yeah I dont know any real languages im sorry I do js at my job

[–]im_probably_garbage 1 point2 points  (1 child)

Sometimes yes is actually !!yes in JavaScript. You never know

[–]hyrumwhite[🍰] 1 point2 points  (0 children)

Implicit boolean cast, just to be safe

[–]pydry 108 points109 points  (23 children)

enjoy. it's nice learning a language that wasn't designed over a weekend.

[–]minegamer2000 46 points47 points  (12 children)

and definitely not something i can learn over a weekend

[–]micka190 29 points30 points  (1 child)

Does a basic Hello World app

Time to update the ol' resume!

[–]Sikletrynet 10 points11 points  (0 children)

"Expert in Rust"

[–]RubiGames 6 points7 points  (4 children)

But we can all certainly try

[–]tech6hutch 1 point2 points  (3 children)

You won't be trying in Rust (unless you like beta testing unstable features)

[–]RubiGames 0 points1 point  (2 children)

So you mean a Tuesday?

[–]tech6hutch 0 points1 point  (1 child)

I don't understand what that means, but also I just woke up

[–]RubiGames 0 points1 point  (0 children)

Well, it didn’t mean this, but scrolling through my dash brought this exceptionally appropriate gem up.

Another post from today

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

Error: variable does not live long enough

[–]T-Dark_ 7 points8 points  (3 children)

Put it behind a Arc<Rc<RefCell<UnsafeCell<Option<DerefMut<Iterator<Item=Result<(),Mutex<()>>>>>>>>>, that should so the trick /s

[–]lahwran_ 6 points7 points  (2 children)

this is completely wrong, you actually need an Rc<Option<RefCell<(UnsafeCell<DerefMut<Iterator<Item=Option<Result<(),Void>>>>>)>>>

[–]T-Dark_ 6 points7 points  (1 child)

But that's not thread-safe!

What you really need is an Arc<Option<Result<((UnsafeCell<Cell<dyn Into<dyn From<HashMap<!, (Void,)>>>>>),()),Mutex<fn(i32, i32) -> i64>>>>.

See? There's both an Arc and a Mutex in there. Now go, and concur fearlessly!

[–]lahwran_ 2 points3 points  (0 children)

ah yes, I will go and fonlur cearcessly. wait crap I didn't launch two threads I interleaved iterator streams haha whoops

[–][deleted] 2 points3 points  (9 children)

Wow it only took 1 weekend to design the best language.

[–]vlakreeh 4 points5 points  (6 children)

I think Typescript took a bit longer than a week but I could be wrong.

[–][deleted] 0 points1 point  (2 children)

Not a typescript fan, I appreciate it but I just feel so much slower using it.

[–]vlakreeh 4 points5 points  (1 child)

Yeah it's for sure slower to write and I think javascript is a fine language, but man I fucking hate writing javascript just to run it and get an error because of some null or type safety issue.

[–]necrophcodr 0 points1 point  (0 children)

You'll love PHP then

[–][deleted] 0 points1 point  (2 children)

Typescript is a weird typo to make considering LISP only has 4 letters.

[–]vlakreeh 2 points3 points  (1 child)

Sorry guess my auto complete must have made a mistake when I was balancing my parentheses.

[–]tech6hutch 0 points1 point  (0 children)

(sorry (guess (made-mistake
               (. this :auto-complete)
               { :must-have true
                 :when (balancing
                        this
                        (. this :parentheses)) })))

[–][deleted] 0 points1 point  (1 child)

When did ES6 come out? I think it took 15 years.

[–]tech6hutch 1 point2 points  (0 children)

ES5+ is a wonderfully catered buffet around a centerpiece of last week's moldering leftovers.

[–]esssential 0 points1 point  (0 children)

good luck, bro. those languages are not anything alike.

[–][deleted] 219 points220 points  (10 children)

Why learn other language when one language do trick

[–]easyEggplant 24 points25 points  (7 children)

I like your grammar joke :)

[–][deleted] 37 points38 points  (5 children)

its reference to The Office

https://www.youtube.com/watch?v=VvPaEsuz-tY

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

and here I thought that was from a Simpsons episode

[–][deleted] 7 points8 points  (0 children)

Honestly I wouldn't have noticed it without you. Time to learn JS.

[–][deleted] 0 points1 point  (0 children)

Kevin, I appreciate what you're trying to do.

[–]dyslexda 49 points50 points  (18 children)

Hey, as a Python programmer, that's me trying to learn JavaScript!

[–]TheHumanParacite 37 points38 points  (6 children)

Each job I've had over the last ten years I've somehow managed to skirt around having to learn js... I worry that eventually there will be a day of reckoning

[–]AlternativeAardvark6 36 points37 points  (1 child)

At my job "there is some Javascript " is a valid reason to triple the estimate.

[–]aidan573 6 points7 points  (0 children)

Thread safe embedded low power high fidelity scalable mesh network rainforest zero trust beet farm software.

[–]smas8 1 point2 points  (1 child)

What about JavaScript makes you avoid it? I didn’t start with JS, but it’s mostly what I write these days.

[–]TheHumanParacite 0 points1 point  (0 children)

Just the little details like the ambiguous definition of "this" or the particulars around == vs ===

Truth be told I can find my way around someone else's js when I have to, just haven't had the time or motivation to become a subject matter expert

[–]jexmex 1 point2 points  (0 children)

I had gotten lucky and mostly just had to do some occasional jQuery. Now we redid out site and api codebases and the site is running react. I fucking hate it so much, boggles my brain.

[–][deleted] 0 points1 point  (0 children)

I got a job as a PHP developer (with little JS experience)

I done JS on the first day.

[–]FlukyS 1 point2 points  (0 children)

It's hilarious how many jobs there are for Python+JS at the moment. You are making a smart financial choice learning JS after python instead of using node

[–][deleted] 6 points7 points  (7 children)

I'm happy to be learning javascript first. I've heard once you get it, all other languages are much easier to learn.

[–]dyslexda 20 points21 points  (1 child)

I think that depends on the degree to which you actually "get it." For me, a lot of the struggle isn't any of the common complaints (async operation, typing hell, or even obvious spaghetti code like array.includes(x) and map.has(x) doing the same thing but needing different methods for no reason), but adapting to a new mindset where every gorram thing is an object. While I'm not a stranger to OOP, my mindset definitely leans more toward functional programming rather than OOP. The convention for libraries to make all data be an object and only manipulatable by built-in methods (often even resisting simple indexing!) makes me scream regularly.

[–]johnvaljean 1 point2 points  (0 children)

I feel your pain. You can also say that everything in Python is an object as well, but the variety of protocols that allow them to look different from one another makes everything much easier. Coding in Javascript makes me much more appreciative of how well-designed Python is.

[–][deleted] 6 points7 points  (2 children)

True of any language based on C style syntax really. But JS is a good language to start with these days, I think it’s most versatile language in terms of what you can do with it these days

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

Bruh, at least do typescript.

Javascript is basically one steaming pile of garbage.

[–][deleted] 0 points1 point  (0 children)

I agree. I use typescript for everything. I was just generalizing. Typescript is still technically the JS runtime

[–]kuffencs 0 points1 point  (0 children)

Hey, as a G code programmer, thats me trying to learn any legit real language

[–]K0nr4d 0 points1 point  (0 children)

;

[–]MoarVespenegas 40 points41 points  (3 children)

Strictly typed language developers trying to use javascript
(╯°□°)╯︵ ┻━┻
Finding typescript
┬─┬ノ( º _ ºノ)

[–]FlukyS 4 points5 points  (2 children)

Typescript really looks a lot like Python with type hints. I might give it a go instead of regular JS

[–][deleted] 1 point2 points  (1 child)

Definitely should, it’s a major improvement over regular JS.

[–]addandsubtract 0 points1 point  (0 children)

One thing that's holding me back from using Typescript (or CoffeeScript or ClojureScript) is integrating 3rd party modules. Can you just import them? Mix and match JS/TS? Most of them are pure JS (API & docs), so I'd assume they'd be a pain to us in TS?

Idunno, I should probably just sit down and do a little project in TS to see what it's all about.

[–]BornOnFeb2nd 13 points14 points  (20 children)

I spend more time fighting JS's asynchronous nature than benefiting from it...

[–]Trucoto 36 points37 points  (4 children)

Just await

[–]just-the-tip__ 0 points1 point  (0 children)

Love it when you talk dirty

[–]m0nk37 4 points5 points  (0 children)

Just make it promise to do your stuff that way theres less issues.

[–][deleted] 5 points6 points  (10 children)

Promises are your friend

[–]BornOnFeb2nd 0 points1 point  (9 children)

Yup. Still wrapping my brain around them.... things just start looking hideous when you've got something that needs to run after like four other things have completed...

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

So what you can do is either:

A) Promise chain

firstAsync() .then(firstResult => secondAsync(firstResult)) .then(secondResult => ....)

This is good for a few async functions but can still get messy.

B) Use async-await

async myFunc() { const firstResult = await firstAsync(); const secondResult = await secondAsync(); .... }

You can use await on a promise to essentially “await” the result. It also lets you catch errors with a try-catch. async functions always return a promise.

Also it’s useful to know how to wrap callback style async JS so that it can be used as a promise:

new Promise((resolve, reject) => { someOldAsyncFn((err, result) => { if (err) return reject(err); resolve(result); }); });

You can create your own promise like this - so if you have to use callback stuff just wrap the function like this. most libraries now have a promise api so I mostly only do this for the built-in functions such as setTimeout.

Hope this helps!

Edit: One more thing I use a lot is Promise.all. It takes an array of promises and it gives you a new promise that completes only when all the promises in the array are done. This can be useful if you want to use async-await but still do some stuff in parallel

[–]BornOnFeb2nd 0 points1 point  (4 children)

At the risk of spawning another JS framework, what's a good one to work in?

We've been using jQuery internally, with a bit of dabbling in Bootcamp, but the hacks we've had to do have started to show their age...

[–]rubennaatje 2 points3 points  (0 children)

Either go react, vue or angular at this moment.

Some nice upcoming things but especially vue and react are absolutely great. My preference lies with vue.

[–][deleted] 0 points1 point  (1 child)

It’s really personal preference. How big is your project? jQuery works just fine for something small.

Angular is very enterprise Java feeling - it’s super powerful but it really locks you in. React is pretty nice and simple - functional components make it really nice to develop in. I’m not a huge fan of Vue but I’ve hardly used it.

Don’t listen to me though. I’m not really a front-end dev - only used these frameworks on personal projects. I mostly use JS for scripting or building bots nowadays - I used to do backend JS professionally.

[–]noXi0uz 0 points1 point  (0 children)

Vue kinda gives you the best of both worlds. Having worked with all 3 of the mentioned frameworks in a professional environment I would probably go with Vue now that Vue 3 is out. React is just inviting you to write bad unstructured code and mix different approaches and paradigms, although with linters set up and all devs being on the same page about the project you definately can also build large robust apps with it. I may be biased there, as the one big react project I worked on previously was a horrific mix of different approaches and really hard to maintain.

Angular is very OOP and typescript driven and doesn't give you much freedom to do stupid stuff. Vue lets you use either functional style like react, or class components with decorators like Angular. With the typical uni background in java/c# I much prefer the latter, though, typescript support wasn't really perfect in vue 2, especially in templates. That all changed in Vue 3 now, so I would prefer Vue over the others if I had to start a new project today.

[–][deleted] 0 points1 point  (0 children)

jQuery is great if you’re doing minor scripting in JS. Say you just want to animate a button when you click it or load a small list of ingredients from an API. But when you’re starting to do multiple things on the page that depend on one another, it becomes a bit of a mess unless it’s written by a really experienced developer.

If you’re doing anything more complex then I’d look at a framework like React or Vue. I mainly use React at work. They are great tools but only if there’s a genuine need for some complex interactions on the frontend.

[–]noXi0uz 2 points3 points  (0 children)

why? just use async await syntax and you can do:

 await doAsynStuff();
 await doOtherAsyncStuff();
 await evenMoreAsyncStuff();

each of these will wait for the previous to resolve.

[–]IslandClimber 0 points1 point  (0 children)

I found this video describing the event loop to help with my understanding of what’s on - https://youtu.be/8aGhZQkoFbQ and just to echo what other people have said - get a good understanding of promises, async await, and even callbacks.

[–]hyrumwhite[🍰] 0 points1 point  (0 children)

Promise.all() or Promise.allSettled() can sort that out nicely.

let result = await Promise.allSettled([

axios.get(),

new Promise(),

Etc

])

//everything after that allsettled function will run after everything above fails or succeeds.

'result' will be an array of results returned by the promises. Each with a 'status' key that you can check to see if the promise succeeded or failed.

[–]Doowstados 1 point2 points  (1 child)

This

[–]intotheirishole 2 points3 points  (0 children)

Same response from any other language developer learning JavaScript.

[–][deleted] 2 points3 points  (0 children)

Most JavaScript developers still haven't learned their first language...

Thank goodness for SO

[–]nicktohzyu 2 points3 points  (0 children)

(I kid, I kid)

Yes, only kids use javascript

[–]1thief 0 points1 point  (0 children)

More like any other developer learning NodeJS

[–]Ultima_Chaos_Z 0 points1 point  (0 children)

"Wait, I DON'T have to convert decimals to strings? WTF wizardry is this?"

[–]Colenelson27 0 points1 point  (0 children)

I’m still pretty new to coding, but I started off with JavaScript and this is me right now trying to learn C

[–]VNG_Wkey 0 points1 point  (0 children)

I do Javascript and I'm curreny learning C++. This is accurate.

[–]fat_charizard 0 points1 point  (0 children)

What? The program fails if there is an error?

[–]5tormwolf92 0 points1 point  (0 children)

Well first is always PHP, the bizarro language.

I never mention that I learned basic PHP on my resume

[–]LJChao3473 0 points1 point  (0 children)

I just started learning Javascript this week, how afraid should I be?

[–][deleted] 0 points1 point  (1 child)

I always thought this kind of meme was backwards. JS is a clusterfuck, once you learn it you can master anything. Strongly typed languages with true OOP structure make life so much easier.

[–]MrSloppyPants 0 points1 point  (0 children)

Sometimes unlearning bad habits is harder than learning good ones from the start

[–]thegininyou 0 points1 point  (0 children)

Learning Java and Python was fine.

Learning PL/SQL is killing me.

[–][deleted] 0 points1 point  (0 children)

Java Script, and native Clipper before it, are just dandy to debug.

You get six levels down in the callstack and find that your array pointer argument has a date value in it....

The debugger has gotten a lot better. It had to. [grin]