How would you call out poorly written code as a junior?

How would you call out poorly written code as a junior?
Context: I got hired at a small start-up as a junior backend dev. One thing I noticed that bothers me a lot is that there are a lot of async functions that mix up `then`s and `await`s together. It's very unreadable and I'm pretty sure the best practice is to stick with either just then syntax or await syntax.
How would I go about saying something like that as a junior, without making my coworkers hate me?

Attached: jd.jpg (960x720, 105K)

Find out if your company has its own standards first. Otherwise say something to a senior close to you. Don't barge into the VP's office with this but it'd not uncommon for previous employees to leave a mess.

There isn't any style guide if that's what you mean.
I git blamed the code and almost all of it was written by my coworker. I was thinking of saying it to him, but I'm still settling in and I don't know how he'd take to having his code corrected. I was thinking maybe I should just shut up and not correct code from people who have been longer in the company than me + have more experience.
I understand this is not strictly programming related, but I'm really autistic and I don't know how I should approach these things in the workplace. I really like this job and I don't want to mess it all up just because I didn't know my place, if you know what I mean?

Do it as passive-aggressively as possible: submit a PR with the code refactored into a nice uniform style and a single "FTFY" as the commit message.

sounds like u just dont know how functions that return promise and await go together

theres situations where mixing them is called for

kek

Ask seniors about their best practices, shows you're willing to learn/adapt while possibly bringing their total lack of adherence to best practices to their attention

Send out a group email to every single person working in the company announcing your official resignation at their lack of professional ability. CEO's love that shit and will recognize "you're not like the other guys, you've got spunk kid" and he'll offer to resign instead, giving you his job. Hope this helps.

Attached: 1538039526367.jpg (300x300, 19K)

How about just ask them why they do it that way?

Probably best to not worry about it for now until you know the people and codebase better. There are far more important things to worry about than mixing then/await. Seems weird that there’s no styleguide though. Once you are more settled you could propose adding one and a linter which you and your team would discuss the rules for, and you could at that point bring up your then/await issue.

That sounds very reasonable.

Just ask them why they've done it this way. If they're smart they'll either catch their mistake and say it was a quick hack or they'll have a valid reason for it. If they're dumb they'll get defensive but you can just shrug it off and say you wanted to learn since you're a jr dev

This. Almost 90% of shit is because of some shitty edge or "framework" design limiting case that you aren't seeing or exposed to yet.

I'm not a programmer but I work on R&D projects. Don't make any noise until you are comfortable doing so. It's the company's problem, not yours so don't risk workplace drama for it

I'm not saying you'll feel comfortable doing it in two years either. Depending on the company and people you may feel comfortable brining it up in a month or not in ten years. Just accept it and don't let it bother you

Can you name an example? I work with js all the time for work and can’t imagine needing both together.

Shorter way of handling errors.
const result = await getResult().catch(() => null)

I did this at my place as a jr. dev
All I can say is that it feels good to be ceo.

Very carefully. Get used to it OP, you haven't seen the worst of it yet.

>you're a junior, don't start with the presumption you know better than everyone else
Bingo.

legit good answer for mixing the two styles but I still can’t see a good case for using then within an async function.

Jeff Dean can decrypt a TLS session just by looking at the public keys

Try...catch is more readable and the standard way of handling errors inside async functions.
Though that syntax is not that terrible, if the entire codebase is standardized to use .catch() for error handling, and no one uses .then().
The entire point of the async/await syntax is to substitute the .then() method chaining which was the standard way of handling promises. There's no point in using async and await if you're going to continue chaining .then()'s all over the place anyway.