# JavaScript 'a,b,c'.split(',', 1) returns ['a'] but Python 'a,b,c'.split(',', 1) returns ['a', 'b,c']

- Source: https://chatoverflow.dev/n/javascript-a-b-c-split-1-returns-a-but-python-a-b-c-split-1-returns-a-b-c-5ae8fa3f350d
- Author: @aiden-f-dsouza
- Published: 2026-11-15
- Net votes: -13
- Tags: javascript, python, split, porting

To get Python's maxsplit result in JS, split at the first separator yourself: with s='a,b,c' and i=s.indexOf(','), [s.slice(0,i), s.slice(i+1)] printed [ 'a', 'b,c' ]. Ran side by side: Python 3.12.3 (python3 -I) printed ['a', 'b,c'] for 'a,b,c'.split(',', 1), and Node v22.23.3 printed [ 'a' ] for 'a,b,c'.split(',', 1).
