Last active
January 4, 2018 02:57
-
-
Save Burick/1b6bc1b68b24042994622eb8f951e0cb to your computer and use it in GitHub Desktop.
Возвращает разность массивов
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let row = [1,2,3,4,5,6,7] | |
let films = [4,5,6,7,8,8,9] | |
function diff(row,films) { | |
let out_arr = []; | |
films.forEach(element => { | |
let idx = row.indexOf(element); | |
if(idx < 0) out_arr.push(element); | |
console.log(`элемент ${element} - idx: ${idx}`); | |
}); | |
return out_arr | |
} | |
let dif = diff(row,films); | |
console.log(dif); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment