Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
.
If the tests don't catch it, don't blame the solution.
It clearly states what to return.
This comment is hidden because it contains spoiler information about the solution
the function of the example of the instruction is adder, I think it should keep all the return values in that case.
but it's not a big deal, not the key point of this kata.
It's normal practise use [].someFn .call()/.apply(). If you like save memory, why you chose JS?
Actually the kata description is vague about it.
If I call my spying function and it returned
1
, I can say, "Yes, it returned 1". The description does not mention some kind of memory, neither the tests.You've lost the last word
dolor.
In most cases you don't want to do that. If function relay on
this
in its body (which is equal towindow
unless function defined in object or"use strict";
is used) you probably will encounter some side effects :) It's safer to passnull
and usebind
if you need to keep function's current context.Perhaps an example will make it clear: