$ ./guess_the_languageProblem Solving — fill the blank
Problem Solving — fill the blank · medium · #117

Complete the function

// returns nums sorted in ascending numeric order
function sortAsc(nums: number[]): number[] {
  return [...nums].sort((a, b) => ____);
}
// sortAsc([3,1,2]) -> [1,2,3]

Answer: a - b (also accepted: a - b, a-b)

a - b sorts numbers in ascending order.
Play Problem Solving ▸