107. Find the largest difference

JavaScriptAlgorithm

easy  - accepted / - tried

Given an array of numbers, pick any two numbers a and b, we could get the difference by Math.abs(a - b).

Can you write a function to get the largest difference?

largestDiff([-1, 2,3,10, 9])// 11,  obviously Math.abs(-1 - 10) is the largestlargestDiff([])// 0largestDiff([1])// 0

Always try to find a better approach.