Ad
  • Custom User Avatar

    "add" and its results must return function. Otherwise such results couldnt be called, so no chaining wouldn't work.
    The kata's description doesnt show important nuance - the result must play as function in context of comparison or arithmetic operations, e.g.

    add(1)(2) == 3
    

    NodeJS command line interface output result of last operation as is - without any conversion, so you see function. It's because only a primitive value can evaluate to primitive without conversions (explicit or implicit). And browser console typically performs conversion to a string when it prints result of last command.

  • Custom User Avatar

    Yes, it appears node handles the toString and valueOf differnelty than browsers normally do.