Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the opposite of ("key" in obj ) in javascript?

This might seem very easy, but here is my question,what is the opposite of

if('name' in obj)

Is it if(!'name' in obj) or if("name" not in obj) or something else?

Thanks!

like image 873
sammiwei Avatar asked Oct 22 '25 15:10

sammiwei


1 Answers

just wrap it in parens:

if( !( 'name' in obj ) ){

Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!