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:
Isah Jacob 2022-10-29 11:35:46 +01:00
parent 4bdabe13e5
commit 746d122896
1 changed files with 7 additions and 3 deletions

View File

@ -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 // Do not edit below this line
module.exports = reverseString; module.exports = reverseString;