scrimba
Note at 1:13
Go Pro!Bootcamp

Bootcamp

Study group

Collaborate with peers in your dedicated #study-group channel.

Code reviews

Submit projects for review using the /review command in your #code-reviews channel

Note at 1:13
AboutCommentsNotes
Note at 1:13
Expand for more info
main.js
run
preview
console
function reverseAString(str) {
// write code here.
let reverseStr = '';

for (i = str.length; i > -1 ; i--){
reverseStr += str.charAt(i);
}

//playing with other methods..
//console.log(str.split("").reverse().join(""));
//return str.split("").reverse().join("");

return reverseStr;
}



/**
* Test Suite
*/
describe('reverseAString()', () => {
it('returns original string reversed', () => {
// arrange
const str = 'hello';

// act
const result = reverseAString(str);

// log
console.log("result: ", result);

// assert
expect(result).toBe('olleh');
});
});
Console
"result: "
,
"olleh"
,
/index.html
LIVE