Javascript map method on array of string elements

后端 未结 8 458
悲哀的现实
悲哀的现实 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条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-11 11:05

    try something like this:

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

提交回复
热议问题