前端项目实战54-split用法

如果在 str 中省略或不出现分隔符,则返回的数组包含一个由整个字符串组成的元素。如果分隔符为空字符串,则将 str 原字符串中每个字符的数组形式返回。

console.log(filter,"filter---1")

    //{is_delete: 0, name@like: '我是测试'} 'filter---1'

    console.log(defaultListOp,"defaultListOp---2")

    //eq defaultListOp---2

    Object.keys(filter).forEach(function (key) {

        // key: the name of the object key

        //属性按照@分割

        const splitKey = key.split('@');

        console.log(splitKey,"splitKey---2")

        //['is_delete'] 'splitKey---2'  ['name', 'like'] 'splitKey---2'

posted @ 2022-10-14 08:19  前端导师歌谣  阅读(60)  评论(0)    收藏  举报