I'm trying to replace underscore _ by its number of occurrence?
'_,_,_,_'.replace(/_/g,(x,i)=>i)
'0,2,4,6'
expected output: '0,1,2,3'
I'm trying to replace underscore _ by its number of occurrence?
'_,_,_,_'.replace(/_/g,(x,i)=>i)
'0,2,4,6'
expected output: '0,1,2,3'