Skip to content

Conversation

@Jimmylxue
Copy link

arrayInclude

新增数组包含函数,判断数组1是否包含数组2,并补充测试用例

来自issues36

/**
 *
 * @desc 判断数组1是否包含数组2
 * @param {Array} arr1
 * @param {Array} arr2
 * @return {Boolean}
 */
function arrayInclude(arr1, arr2) {
	if (arr1 === arr2) return true
	if (arr1.length < arr2.length) {
		return false
	}
	return !arr2.some(item => {
		return !arr1.includes(item)
	})
}

@proYang
Copy link
Owner

proYang commented Nov 29, 2022

@Jimmylxue 牛啊,哥们,不过推荐用 lodash 吧。这个仓库的价值,更多在于学习封装一个工具库。:smile:

@Jimmylxue
Copy link
Author

@Jimmylxue 牛啊,哥们,不过推荐用 lodash 吧。这个仓库的价值,更多在于学习封装一个工具库。😄

好滴,我还以为有机会能够成为这个明星项目的 contributor 呢~😋

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants