const checkPlaindrome = (str) => {
return str === str.split('').reverse().join('')
}
console.log(checkPlaindrome('WOW'))
const finLongestWord = (str) => {
let splited = str.split(' ')
let longestWord = ''
for (let i = 0; i < splited.length; i++) {
if (longestWord.length < splited[i].length) {
longestWord = splited[i]
}
}
return longestWord
}
console.log(finLongestWord('HERE IS THE SENTENCE'))
const reverseWithSequence = (sen) => {
let splited = sen.split(' ')
let newVal = []
for (let i = 0; i < splited.length; i++) {
newVal.push(splited[i].split('').reverse().join('') )
}
return newVal.join(' ')
}
console.log(reverseWithSequence('NOW LETS SEE'))
console.log(reverseWithSequence('I NOW WON'))