Web Log of Ross Chapman

Web Log of Ross Chapman

The explanation of Question 12 of Lydia Hallie's fabulous list of JS interview questions, and others

Lydia Hallie’s list of JS interview questions are extensive and probably one of the most comprehensive resources out there. The laundry list of questions runs the gamut from basic to esoteric language features, each of which progress you though various themes in what seem like meaningful sequences. It appears some modicum of pedagogy is involved, which therefore avoids that oft vacancy of substance typical of a listicle.

Yesterday I was running through a block of questions with an ex-colleague and we noticed that some of the answers were a bit inchoate. It’s so easy for meaning to drift when talking about language features especially when it comes to JS. Consider navigating the following taxonomy – related to creating objects in JS – for readers of all skill levels without specious reasoning (the kind of short-hand you get the point or close-enough superstitious explanation we sometimes use; which, by the way, I think greatly hindered my early career development): object, constructor, function, class, prototype, instance, static, method, new, this. It’s quite hard but really worth being as correct as interpreting ECMAScript affords us.

I decided to open up some discussion on Question 12 which tests one’s knowledge of the differentiated effects of using the new operator before a function call:

https://github.com/lydiahallie/javascript-questions/issues/82#issuecomment-645022140

Definitely called for a little revisit of YDKJS, no doubt.

I also feel like I need some clarification on Question 14. What do we call the very root object in JS that all objects delegate to?

https://github.com/lydiahallie/javascript-questions/issues/26#issuecomment-645058195

Coming up with examples is hard. I think Question 11 could use a bit of rework too because there is a this scope issue that somewhat overloads the focus of the problem. Here I go again:

https://github.com/lydiahallie/javascript-questions/issues/355#issuecomment-645066354