Python Method Chaining Javascript Interview