More Objectively-BadProblematic JavaScript Assessment Items
Which of these is NOT a type of Error?
InternalError
RangeError
EvalError
ControlFlowError
Pluralsight's Answer
ControlFlowError
My Comments:
This question has an incorrect answer.
InternalError
is also not defined in browsers or defined the ECMAScript specification, and so should also be a valid answer.
Which is the proper way to do prototypal inheritance?
function superclass() {this.stuff="stuff";} function subclass() {subclass.prototype = new superclass();}
function superclass() {this.stuff="stuff";} function subclass(superclass) {}
function superclass() {this.stuff="stuff";} function subclass() {} subclass.prototype = new superclass();
function superclass() {this.stuff="stuff";} var subclass = new superclass();
Pluralsight's Answer:
function superclass() {this.stuff="stuff";} function subclass() {} subclass.prototype = new superclass();
My Comments:
None of these answers is correct.
To the extent that this was ever a correct answer, that ended in ES5 (published in 2009) with the addition of
Object.create()
, which is a cleaner way to set up a prototype. But even prior to that, a general solution to setting up prototypical inheritance requires this dummy constructor dance, which Pluralsight does not provide as an option.
How do you remove an object from the global scope?
- You can't remove an object from the global scope.
- Assign it to
null
- Memory management will remove it automatically if not referenced.
- Use the
delete
keyword
Pluralsight's Answer:
- You can't remove an object from the global scope.
My Comments:
This question has ambiguous/incorrect wording.
The question doesn't ask "how do you remove a binding", or "a variable", or "an assignment" from the global scope, it asks how you remove "an object". And you could indeed detach "an object" from the global scope by "2. Assigning it to
null
" and then "3. Memory management will remove it automatically if not referenced".
Aside
Pluralsight IQ is roughly linearly-distributed.
Traditional IQ is roughly normally-distributed.