ruju11235 / csp

Small programs using the JavaScript syntax. I'm just starting to learn :)
0 stars 1 forks source link

Reverse a given list in place #9

Closed kedarmhaswade closed 1 month ago

kedarmhaswade commented 1 month ago

Write a function reverse that reverses the given list in place.

Here is the specification:

// Reverses the given list, xs, in place.
// Thus, if an element e was at the index i in the list before applying the function,
// it will be at the index xs.length-1-i after the function returns.
function reverse(xs)
{ 
// your code
}

How will you test your function?