var max = arr.reduce(function(a, b) { return Math.max(a, b); });
which is totally valid for javascript and also pretty neat. I would probably do some funny things with loops instead, wasting time and resources.
var max = arr.reduce(function(a, b) { return Math.max(a, b); });
which is totally valid for javascript and also pretty neat. I would probably do some funny things with loops instead, wasting time and resources.
Sometimes people who have DECADES of walking experience just... fall.
At the end is a hands on leet-code test. I cannot for the life of me remember what it was about. I do remember writing a function to replace 'abs', and realising that my brain was not even in the same county.
Yeah. People fail for all sorts of reasons. But when it's odd, maybe it is them. But beware. Maybe it's you.
I am glad I flunked hard in Bristol. I think I would have hated it. But then if I was a rubbish coder I would say that too.
It was a CTO role and I'd just aced a presentation on "How to launch a new product" and I could not context switch to coding mode fast enough.
I wonder if I’m one of the anecdotes about people in tech who can’t do the basics. That would at least amuse me somewhat.
Even when I know how to do something, I look it up just in case. Sometimes there's a cleaner approach, or I learn that I don't fully understand the problem.
(this sort of discussion is what I'd love to see in a tech interview)
Let us assume that you are a competent worker that other firms want to hire. What is the best way to find people like you and to test/interview people with ADHD?
To be clear, I do not have ADHD, so I have no personal experience with this important topic.
Personally... I had another profession before and was never asked anything during interviews. They just assumed I was capable because I had a degree, work experience and references. So I'm not quite sure where that even is coming from, it's unheard of in other professions.
Premature optimisation:
In most cases the performance would not matter. Instead of optimising for performance you should optimise for readability. IMHO IFs and FORs are way more readable in any context than any language specific methods like REDUCE and MAX.
Incorrect optimisation:
At least in modern browsers, simple IFs and FORs are the most optimised methods of doing anything. See for instance https://leanylabs.com/blog/js-forEach-map-reduce-vs-for-for_... (Operations per second, higher is better).
Mind you I’m talking in general and now in browser specifically
I take the exception that on this case in particular, the reduce is much more readable than a loop. Javascript isn't completely on the "anything non-imperative could as well be in machine code" league, but has plenty of problems that appear when you try to write other kinds of declarative code.
The idea that “reduce” is language specific is frankly mind boggling. It’s no more language specific than a loop.