For positive numbers , X must be placed at the last index where it is smaller than N [ i ]
for ( let i = len - 1 ; i >= 0 ; i -- ) { if ( ( N [ i ] . charCodeAt ( 0 ) - ' ' . charCodeAt ( 0 ) ) > X ) { position = i ; } } }