Reduce Function Array Javascript Splice String In Python W3schools