Javascript map method on array of string elements

后端 未结 8 579
悲哀的现实
悲哀的现实 2021-01-11 10:09

I am trying to understand how to implement the map method (rather than using a for loop) to check a string for palindromes and return boolean values for whether the mapped a

8条回答
  •  萌比男神i
    2021-01-11 10:58

    Javascript map method on array of string elements by using split() function.

    let str = 'hello';
          
        str.split('').map((x)=> {
            console.log("|"+x+"|");
            return x;
        })
    

提交回复
热议问题