Directi interview question

Write a function for palindrome using JavaScript.