美文网首页
2020-05-26

2020-05-26

作者: 我就看看我不说话_1900 | 来源:发表于2020-05-26 01:19 被阅读0次

    JS 一维数组简单去重

     var list = [1,2,4,7,1,2,3,9,5,3,11,20]

            var temp = []

            for(var i in list) {

                if((temp.indexOf(list[i]) == -1)) {

                    temp.push(list[i])

                }

            }

            console.log(temp)

    相关文章

      网友评论

          本文标题:2020-05-26

          本文链接:https://www.haomeiwen.com/subject/fzmpahtx.html