I am trying to finalise this coding challenge: https://www.hackerrank.com/challenges/lilys-homework/problem , but am unsure how I should approach the last if statement. Other approaches in solving this are welcome as well.
function lilysHomework(arr) {
console.log(arr)
let sortedarr = arr.sort(function(a,b){return a-b})
console.log(sortedarr)
for(var i=0;i<arr.length;i++){
if(arr[i] == sortedarr[i]){
continue
} else if(arr[i] !== sortedarr[i]){
for(var j=0; j<arr.length;j++){
if(arr[i] == sortedarr.indexOf()){
}
}
}
}