2 ms·
Adding to this, I think even a little bit of genuine esoterica is okay in an interview process so long as: 1) You're looking for someone with deep knowledge of
by brundolf 5y ago
Adding to this, I think even a little bit of genuine esoterica is okay in an interview process so long as:
1) You're looking for someone with deep knowledge of that subject
2) You don't treat it as an automatic fail when they get it wrong
If I'm interviewing for a senior role, and I ask them a few super obscure questions about the language/framework/platform I need them to be an expert on, that serves as a litmus test for their overall depth of knowledge. Those facts individually may not be required for the job, but they give a read on how deep the person's knowledge goes in general.
But, as you pointed out, I wouldn't really even put closures in that category. For JS it would be something more like, "What does '{} + 12' evaluate to?"
- Rapzid 5y ago> For JS it would be something more like, "What does '{} + 12' evaluate to?" It would be really hard for me to take the process serious if I was asked that during an interview.
- brundolf 5y agoAgain, it's just a signifier. If you know the answer (or can explain a good guess!), you probably also know a bunch of actually-useful dark corners of the language. If you don't know the answer, you may still know all those other things. It's just one data point among many.
- dorgo 5y ago({}) + 12 evaluates to "[object Object]12" omg, I need to learn / start using typescript
- brundolf 5y agoYou're right! Though the original question - '{} + 12' - is extra tricky and actually evaluates to 12 ;) I'll leave figuring out why as an exercise for the reader
- dorgo 5y agoIt depends. x = {} + 12; x has the value "[object Object]12". So, it' not always 12 :P
- readonthegoapp 5y agocan confirm: https://replit.com/@atlwellwell/EsotericJSInterviewQuestion#index.js https://replit.com/@atlwellwell/EsotericJSInterviewQuestion#... at this point, i'd love to know when the answer is just '12'. i remember going at it with some dude back in the day who was 100% certain, and got visibly upset, when i stood my ground that java only used pass by value. i allowed that even object references were being passed, but that they were passed by value. i didn't get the job.
- dorgo 5y ago>at this point, i'd love to know when the answer is just '12'. Ctrl+Shift+k in a browser (firefox) opens a console. Just write {}+12 there and hit enter. My guess is that {} is (in some circumstances) evaluated as a block of code (instead of an empty object). Since the block is empty it evaluates to undefined. The +12 is considered another block of code ( the + operation takes here only one parameter - so it is not a sum ). Consecutive blocks of code are evaluated to the value of the last block of code, which is +12. {}/12 for example doesn't work at all - which is a hint that the + is not a summation operation. Edit: I'm wondering why we use 12 and not 42 Edit2: Technically you are correct about java being pass by value. But at this point I'm questioning the sanity of the distinction. It feels more and more like a philosophical discussion.