scrimba
Note at 0:00
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 0:00
AboutCommentsNotes
Note at 0:00
Expand for more info
main.js
run
preview
console
function reverseAString(str) {
if (!str) {
return str;
}

let reversed = '';

let j = str.length - 1;
while (j >= 0) {
reversed += str[j];
j--;
}

return reversed;
}



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

// act
const result = reverseAString(str);

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

// assert
expect(result).toBe('taht ees I naC');
});
});
Console
"result: "
,
"taht ees I naC"
,
/index.html
LIVE