check if the givven array is sorted or not.
array to check if is sorted
function to use for comparison operation
isSorted([1,2,3]) //true isSorted([1,3,2]) //false Copy
isSorted([1,2,3]) //true isSorted([1,3,2]) //false
isSorted(['a','b','c']) //true isSorted(['a','c','b']) //false Copy
isSorted(['a','b','c']) //true isSorted(['a','c','b']) //false
isSorted([{ x:1}, { x:2}, { x:3}], (o1,o2)=> o1.x-o2.x) // true isSorted([{ x:1}, { x:3}, { x:2}], (o1,o2)=> o1.x-o2.x) // false Copy
isSorted([{ x:1}, { x:2}, { x:3}], (o1,o2)=> o1.x-o2.x) // true isSorted([{ x:1}, { x:3}, { x:2}], (o1,o2)=> o1.x-o2.x) // false
check if the givven array is sorted or not.