function checkPalindrome(inputString) {
let originalString = inputString;
let reversedString = originalString.split('').reverse().join('')
return originalString == reversedString;
}
let the originalString be a variable for argument input string.
let the reversedString be a variable that has reversed string
how the reverse proceducre is done?
originalString.split('') , this will convert string to a array
for ex: inputString = "aabaa"; then inputString.split('') will convert string to an array
it will become ['a', 'a' , 'b' , 'a' , 'a'].
then reverse() method just reverses the array
and join() method just converts array to string.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
function checkPalindrome(inputString) {
let originalString = inputString;
let reversedString = originalString.split('').reverse().join('')
return originalString == reversedString;
}
let the originalString be a variable for argument input string.
let the reversedString be a variable that has reversed string
how the reverse proceducre is done?