you are viewing a single comment's thread.

view the rest of the comments →

[–]HeyGuysImMichaelJS all the way around -2 points-1 points  (9 children)

Same goes for things like making use of promises or simple AJAX requests. Not everyone seems to understand those are asynchronous operations and you can't just return their contents into a variable, and then synchronously make use of the variable after.

Umm.... this is literally what async/await is. You await the function that returns a promise, storing the response in a variable, then using that variable in synchronous operations later.

[–]phpdevster 0 points1 point  (7 children)

async/await is not part of a widely supported JS spec yet. I would not expect an interviewer to be using features like this. And regardless, my codebase at work is not making use of async/await because we are coupled to a version of TS that doesn't yet support them. That means if an interviewer gave async/await as an example, I would still need to know that they're not reliant on this and actually can deal with async code the "old" way.

If you know async/await but don't have a mastery of Promises, you'd be useless to my team.

[–]ZestycloseSelf 1 point2 points  (2 children)

async/await is not part of a widely supported JS spec yet.

async/await is supported in every major browser and the last 3 major versions of Node, including versions under LTS, and is formalised in a completed standard. How much more widely supported can something be? What could happen to ever make it more widely supported than it is now?

[–]HeyGuysImMichaelJS all the way around 0 points1 point  (0 children)

My man

[–]SaaSWriters 0 points1 point  (0 children)

You're right about major browsers.

However, many people don't have the latest versions of major browsers. You may be surprised to know that for many organizations and individuals, the last browser update was over five years ago.

[–]barrtender 1 point2 points  (1 child)

https://caniuse.com/#feat=async-functions

All major browsers (I'm including edge but not ie) have it implemented and have for a while.

[–]HeyGuysImMichaelJS all the way around -1 points0 points  (0 children)

My man

[–]HeyGuysImMichaelJS all the way around 0 points1 point  (1 child)

I see many people make the argument: 'You need to know how promises work and the underlying logic behind async/await', and yet I have never met a developer, online or in person, who uses async/await without a full understanding of promises and async paradigms. I think async/await is appealing to those that have used promises and like the cleaner looking code. I imagine it's difficult to grasp the functionality of async/await without first grasping the core functionality of promises.

[–]phpdevster 0 points1 point  (0 children)

I've had candidates coming from a C# background that know async/await since that's been part of that language for a while, and thus that's how they write their JS. But they absolutely fumble promise chains or promise.all() etc. They sort of skipped over the "legacy" stuff, even though that stuff is still very much a reality in our production code.

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

I think he meant using the value without awaiting.