var v = "023030333830303630313233343536373839303132333435363738393031323334353637383930303030303030303030303030303030303030303030303030313233343536373833313230323231313039303030303132333430303030303030303030303030313030313033314303"; var nv = ""; var flag = false for ( let vv of v ) { nv += vv; if ( flag ) { nv += " " flag =false } else { flag = true } } console.log( nv )