4
b2plane
2y

Interview question i had:

- how does jwt work under the hood, where is it stored, what 3 parts is it made of, who creates jwt, how does the server know what information the jwt token has (how can it say oh you're Joe you can login now)

- what is the difference between observable and promise in typescript, how does observable work, what is a stream, what is the difference between fetching data through an observable and fetching data with promise and when should we use one over the other, what does .next() funcrion do in observable under the hood

Answer me these questions without googling

Comments
  • 3
    Oh wow. I actually would like to be interviewed with these kinds of companies. Shows they know what goes on instead of just being users of libraries.

    I can probably answer most of the first question and it's actually useful to know if you would deal with authentication.

    I think it's valid to ask them to describe just a bit of what they are looking for and make an educated guess
  • 2
    Are you fucking kidding me? You use Angular and can't answer those without googling?

    JWT has head, payload, signature, separated by dots. Head and payload are base64-encoded JSON, so server can simply decode them and get all the relevant information. It's created and signed by the server, then it's stored on the client and added to requests, usually as auth header.

    Promise resolves once and then emits the same result every time you call .then / await it, and if you chain multiple .then() calls they will get executed immediately when the promise resolves. Observable emits results only when it has a subscriber, by default it doesn't hold a result, and pipeline operations only get executed when there's a subscriber to listen for the result. A next function checks if there's a subscriber and if there is one, it passes the input value to it. Promises are better if you need to perform an action and wait for the result, observables are better to get an updated value on every change.
  • 4
    Yes I'm mocking you. Two weeks ago you made a rant praising Angular and talking about "years of experience" with it, but on an interview you can't answer about observables which are literary the core thing in Angular. And then you cry because people won't hire you and how your degree is useless.

    The only useless thing is you.
  • 1
  • 1
    Back to freelancing?
  • 1
    @hitko the guy probably treats observables as fancy promises
  • 1
    @nitnip Dude I get piles of CVs from people like him that boast "years of experience" and then can't answer some basic questions relevant to their "experience". And when they fail the interview, they go complain online how "companies have unrealistic expectations" or how "a college degree is worthless". I'm fucking tired of those dipshits, and I'm especially tired of them flooding every single developer community with their whining.
  • 2
    @hitko so how am i capable of building robust and scalabe software with angular? I have already earned thousands from american clients. I've built and used observables all over the place. I know how to implement them and i understand how they work, but i havent researched THAT deeply under the hood of how they operate. Since i can get the job done without knowing "why the car leaks oil", respectfully sir, fuck off.
Add Comment