How to use filter to remove weight in JavaScript
Editor to share with you how JavaScript uses filter to remove weight, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!
Using filter
Function unique (arr) {return arr.filter (function (item, index, arr) {/ / current element, first index in the original array = = current index value, otherwise return current element return arr.indexOf (item, 0) = index;}) } var arr = [1 unique (arr)) / / [1, true, true,15, false, undefined, null, NaN ", 0," a ", {… }, {... }] these are all the contents of the article "how to use filter to remove JavaScript". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!