forked from Zelechos/Pragmatic_JavaScript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExercise22.js
More file actions
20 lines (17 loc) · 763 Bytes
/
Copy pathExercise22.js
File metadata and controls
20 lines (17 loc) · 763 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// 22) Programa una función que valide si una palabra o frase dada, es un palíndromo (que se lee igual en un sentido que en otro), pe. mifuncion("Salas") devolverá true.
import validateString from './validations.js'
'use strict'
const palidromoText = data =>
(validateString(data))
? console.log(`the word {${data}} is a palindrome => ${String(data.toLowerCase()) === String(data.toLowerCase().split("").reverse().join(""))}`)
: console.warn(`wrong parameter => parameter{${typeof(data)}} \n was expected => parameter{string}`)
// Testing
let text = new String("Solos");
palidromoText("salaS");
palidromoText(text);
palidromoText(9);
palidromoText([]);
palidromoText("programmer");
palidromoText(false);
palidromoText("1001");
palidromoText();