added a parameter to the function
I used the .split, .reverse and .join method to be able to reverse the string created a variable that holds the reversed string
This commit is contained in:
parent
4bdabe13e5
commit
746d122896
|
@ -1,6 +1,10 @@
|
|||
const reverseString = function() {
|
||||
|
||||
const reverseString = function(string) {
|
||||
let enteredWord = string.split("").reverse().join("");
|
||||
return enteredWord
|
||||
};
|
||||
|
||||
reverseString("hello")
|
||||
reverseString("hello there")
|
||||
reverseString('!abc 123!')
|
||||
reverseString('')
|
||||
// Do not edit below this line
|
||||
module.exports = reverseString;
|
||||
|
|
Loading…
Reference in New Issue