Let's say if the one part of the interview question that involved JavaScript is: how do you determine if a value is numeric (including if it is a string in an input box). If you say JS is usually weird in these things and you may need to google it, they may view you as "not good", but if you spit out that weird line / function, the interviewer may type in the report that you are "extremely good" and therefore can be a senior or principal engineer. One possible way is function isNumeric(n) { return !isNaN(parseFloat(n)) && isFinite(n); } but personally I won't think the person who can spit it out is more senior. How do you view it? #interview
It's not about memorizing. People who understand the technology they use, its history and design trade offs, can compose code like that effortlessly.
history and design trade offs... you are so full of it. There are so many strange cases in JavaScript that even people who got involved in JavaScript in 1995 till now need to look things up and you are saying "effortlessly".
This is honestly an idiotic question in any interview - but Iâd run away from a company using such a question to determine levels.
JS isnât really that weird about it tho. (typeof variable === ânumberâ) ? true : false
just typeof variable === ânumberâ works too you can also use isNaN
it is far more complicated than that... for example, "1.23" should also be considered to be numeric and NaN has a type of number but is not considered to be numeric. And your line (typeof variable === ânumberâ) ? true : false really can be just (typeof variable === ânumberâ)