51. search element right after target with Binary Search(possible duplicate array)

easy  - accepted / - tried

This is a variation of 37. implement Binary Search (unique).

Your are given a sorted ascending array of number, but might have duplicates, you are asked to return the element right after last appearance of a target number.

If not found return undefined.


Please don't use Array.prototype.lastIndexOf(), it is not our goal.

Always try to find a better approach.