- Write a function which takes an array as input, checks each element (which can be a string or a number) to determine if it is a palindrome, and then returns an array indicating whether each element is a palindrome or not, following the pattern specified in the given example.
Input array: ['dad', 1331, 'cat', 255, 'noon'] Output array: ['palindrome', 'palindrome', 'non-palindrome', 'non-palindrome', 'palindrome']
-
Write a string transformation function that converts input strings in various formats (i.e., "i_love_cats", "i-love-cats", "iLoveCats", "I love cats") to the desired output format "I love cats".
-
What are the different methods to compare two objects in javascript and explain with an example.