Find all indices of a given element in sorted form of given Array
function indexesOfElement(array, target){
let smCount=0;
let occurence=0;
for(let x of array){
if(x<target){
smCount++;
}
else if(x===target){
occurence++;
}
}
let result=[]
if(occurence==0){
return []
}
else{
while(occurence--){
result.push(smCount);
smCount++;
}
}
return result;
}
console.log(indexesOfElement([1, 2, 5, 2, 3],3))INFO