Python Method Chaining Javascript