#I want to show all the names of array2 , but with the exception of the names that are in array 1

1 messages · Page 1 of 1 (latest)

prime seal
#

i have this array


let array1 = [
'Carlos','Mariana','Joao']

let array2 = [
'Julia','Carla','Mateus','Max','Joao','Harry','Carlos']

//
so i want to show on console the array2 ,
like a

for(let i =0; i < array2.lentgh; i++) {
console.log(array2[i])
}

how do I display array 2 on the console (without the names that are inside array 1)
the name "carlos" is inside array1.
I want to show all the names of array2 , but with the exception of the names that are in array 1

round acorn
#

@prime seal so u want to filter?

prime seal
#

yes

round acorn
#
const filteredArray = array2.filter(item => !array1.includes(item))
#

also ur asking in the wrong server, next time ask in one of the #useful-servers

prime seal
#

ok