Ad
  • Custom User Avatar

    Open your browser console and type 0? true: false and then 0.1? true: false and keep changing the numbers. You will understand, it worked for me.

  • Custom User Avatar

    I've checked this very example in Python and the logic is the same, no error raised.

  • Custom User Avatar

    Function can call another function. Let's say the function has been already executed (Stringify) and the flow reached the line "Stringify(list.Next)". At this moment function has been already initiated as the flow "already works" so no error would be rised - but because we are calling same function it is called recursion ... and recursion works for python as well.

  • Custom User Avatar

    First of all study Node class really carefully. You will recognize that Node.data actually holds an integer and Node.next holds...another object Node which holds ... yes an integer and another object of type Node...and so one till Node.next holds null. I suggest to take a look closer at recursion as "conceptually" will not be enough to understand this very example. Answering your questions: When you call Stringify(list.Next) you are calling the method with object Node. Integer of that object is concatenatted to the resulted string (recursively) As i said earlier on Node.next holds another object Node or null. I would call it a tail recursion.

  • Default User Avatar

    Are you mutating the input?

  • Custom User Avatar

    Same. I forfeited the kata and saw the top solution was the one I was attempting.

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    Ternary operator.

  • Custom User Avatar

    Javascript tests are pretty bad, using test.expect but you must be doing something wrong to fail them. Try printing the input with console.log and see why it fails. The expected answers are ok.