Recursive functions don't casue stack overflow in JS