samedi 29 mai 2021

"in" keyword not working properly when used with object.value in node [duplicate]

I need to execute some code. But my code is not working properly. I have made an simple example to demonstrate the malfunction.

When I run

console.log("val" in Object.values({key:"val"})); //returns false

It gives me false. But if I run

console.log(Object.values({key:"val"}))

outputs => ['val']

I don't understand if it is supposed to work like this. If yes. Why ?

Thanks in Advance.....:)




Aucun commentaire:

Enregistrer un commentaire