You are viewing a single comment's thread. Return to all comments →
` function reverse(a) { let j = 0; for (let i = a.length - 1; j < i; i--) { let temp = a[j]; a[j] = a[i]; a[i] = temp; j++; }
return a; // THAT IS IT!
} `
Seems like cookies are disabled on this browser, please enable them to open this website
Arrays - DS
You are viewing a single comment's thread. Return to all comments →
` function reverse(a) { let j = 0; for (let i = a.length - 1; j < i; i--) { let temp = a[j]; a[j] = a[i]; a[i] = temp; j++; }
} `