let bobsFollowers = ['Joe', 'Marta', 'Sam', 'Erin'];
let tinasFollowers = ['Sam', 'Marta', 'Elle'];
let mutualFollowers = [];
for (let i = 0; i < bobsFollowers.length; i++) {
for (let j = 0; j < tinasFollowers.length; j++) {
if (bobsFollowers[i] === tinasFollowers[j]) {
mutualFollowers.push(bobsFollowers[i]);
}
}
};
console.log(mutualFollowers);
'JAVASCRIPT' 카테고리의 다른 글
The .filter() Method (0) | 2020.06.23 |
---|---|
The .forEach() Method (0) | 2020.06.14 |
scope 예문 (0) | 2020.06.08 |
es6 좀더 간결한 표현 (0) | 2020.06.08 |
삼항연산자 예문 추가 (0) | 2020.06.05 |