constsmaller=(arr:number[]):number[]=>{// loop over itemsreturnarr.map((item,i)=>{// get array of remaining itemsconstrest=arr.slice(i+1,arr.length);// filter for items less than the current itemconstlessThan=rest.filter(curr=>curr<item);// count the items less thanreturnlessThan.length;})}
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Discussion on: Daily Challenge #256 - How Many Are Smaller Than I?
For further actions, you may consider blocking this person and/or reporting abuse