simple-utils-js
Version:
前端,前端开发,前端框架,web前端,前端面试题,技术文档,学习,面试,JavaScript,js,ES6,TypeScript,vue,python,css3,html5,Node,git,github,markdown
17 lines (14 loc) • 354 B
JavaScript
/**
* @description: 检查两个数组各项相等
* @param {*} arr The array
* @param {*} arr The array
* @return {*} boolean
*/
const isArrayEqual = (a, b) => {
let has = true
if (a.length !== b.length) return has = false
const s = new Set(b);
if(a.find(x => !s.has(x))) return has = false
return has
}
module.exports = isArrayEqual;