Let's just say that Array.includes is making a "shallow comparison". What is happening is that you're comparing an object against a string. Imagine something like this.
Oh yah, I am self-taught artist and a grandaunt in the internet of things who is building Apps that connect visual arts to software devs. So bring it on n let's go animate the world :)
Oh yah, I am self-taught artist and a grandaunt in the internet of things who is building Apps that connect visual arts to software devs. So bring it on n let's go animate the world :)
thank your very much for your kind efforts, i tried it like you stated already but got got a desirable result. i used a set method instead and worked well.
Another contribute here also commented with reducer() that also works perfect :)
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Let's just say that
Array.includes
is making a "shallow comparison". What is happening is that you're comparing an object against a string. Imagine something like this.If you try that it would return
false
.Array.includes
doesn't try to find the string inside the object it, just compares the whole item in the array against your argument.If I were to try implement
Array.includes
as a function it would be like this.i have to look into this approach, thank you very much for the response
Actually I was just trying to explain how
Array.includes
works.What would solve your problem is to transform
formB
into an array of names before usingformA.filter
. Like this.thank your very much for your kind efforts, i tried it like you stated already but got got a desirable result. i used a set method instead and worked well.
Another contribute here also commented with reducer() that also works perfect :)