Question d’entretien chez Insight Global

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

Réponses aux questions d'entretien

Utilisateur anonyme

2 nov. 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

Utilisateur anonyme

2 nov. 2017

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

Utilisateur anonyme

8 mai 2021

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

Utilisateur anonyme

15 nov. 2012

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

1