How do you reverse a string in place (or in-place) in JavaScript when it is passed to a function with a return statement, without using built-in functions (.reverse()<
.reverse()<
var str = 'sample string'; [].map.call(str, function(x) { return x; }).reverse().join('');
OR
var str = 'sample string'; console.log(str.split('').reverse().join(''));
// Output: 'gnirts elpmas'