let Arr=[1,2,3,4,5,6],
Data=[5,6,7];
Arr.find(i=>Data.includes(i))
如果有相同项就返回对应的一项,没有相同项,结果是undefined
比如一个数组
arr = [
{hr: [ "System Architect", "$3,120", "2011/04/25" ], office: "Edinburgh", "extn": "5421"},
{name:'hongyi'},
[1,2,3]
就先按照这个样例来吧,如果我要获取name的值改怎么写一个函数呢
本人能力有限,写的...
const isContained = (a, b) => {
// a和b其中一个不是数组,直接返回false
if (!(a instanceof Array) || !(b instanceof Array)) return false;
const len = b.length;
// a的长度小于b的长度,直接返回false
if (a.length &l
I have a target array ["apple","banana","orange"] , and I want to check if other arrays contain any
function isContained(aa, bb) {
if(!(aa instanceof Array) || !(bb instanceof Array) || ((aa.length < bb.length))) {
return false;
//var aaStr = ...
//是否被包含,是返回true,不是返回false
isContained =(a, b)=>{
if(!(a instanceof Array) || !(b instanceof Array)) return false;
if(a.length < b.length) return false;
var aStr = a.toString();
for(var