Pregunta de entrevista de Insight Global

Implement a method to determine whether a string is a palindrome.

Respuestas de entrevistas

Anónimo

2 de nov de 2017

Take a string as function parameter. Copy this str value into a new var, then use .reverse() thereupon. Compare the reversed copy back against original string using turnery operator to set resVariable to "true" : "false". Return resVariable.

2

Anónimo

2 de nov de 2017

(Using .split(""), as well as .join(""))

Anónimo

8 de may de 2021

const palindrome = (str) => str == str.reversed() palindrome('hello') // false palindrome('eve') // true

Anónimo

15 de nov de 2012

Recursive method; start from the ends and work your way in. Use indices if worried about memory.

1