Create a custom comparison function named compare() to organize numbers in ascending order. Compare two numbers, first and second, by concatenating them in different orders (firstsecond and secondfirst). Determine the correct positioning based on which concatenated number is larger.
function sortNumberArray(array){
array.sort(function compare(first,second) {
var firstsecond ='' + first + second;
var secondfirst ='' + second + first;
return firstsecond>secondfirst ? -1:1;
})
}
function findLargestNum(array){
var largestNum = array.join('')
return largestNum
}
var numArray = [1,3,34,44,4,45,6,76,9,98,23]
sortNumberArray(numArray)
var finalResult = findLargestNum(numArray)
alert(finalResult)