@@ -101,6 +101,13 @@ for (let index = 0; index < message.length; index++) {
101
101
- [] Isogramas
102
102
*/
103
103
104
+ /**
105
+ * Reverse a string
106
+ * @param {string } word Any string word with symbols, spaces and string
107
+ * @returns Returns reversed string word
108
+ */
109
+ const reverseManual = ( word ) => word . split ( "" ) . reverse ( ) . join ( "" )
110
+
104
111
/**
105
112
* Determine if two words are palindromes, anagram or isogram
106
113
* @param {string } firstWord Any string word
@@ -109,7 +116,8 @@ for (let index = 0; index < message.length; index++) {
109
116
*/
110
117
function textAnalizer ( firstWord , secondWord ) {
111
118
//TODO
112
- const resultPalindrome = palindromeTester ( firstWord , secondWord )
119
+ if ( palindromeTester ( firstWord , secondWord ) ) console . log ( "Las palabras son palíndromes" )
120
+
113
121
const resultAnagram = anagramaTester ( firstWord , secondWord )
114
122
const resultIsogram = isogramaTester ( firstWord , secondWord )
115
123
}
@@ -120,7 +128,10 @@ function textAnalizer(firstWord, secondWord) {
120
128
* @param {string } secondWord Any string word
121
129
* @returns Returns a boolean response true or false
122
130
*/
123
- const palindromeTester = ( firstWord , secondWord ) => { }
131
+ const palindromeTester = ( firstWord , secondWord ) => {
132
+ //TODO reversed secondWord check firstWord
133
+ return firstWord . toLowerCase ( ) === reverseManual ( secondWord ) . toLowerCase ( )
134
+ }
124
135
125
136
/**
126
137
* Determine if two words are anagram
0 commit comments