Today I Learned

hashrocket A Hashrocket project

Evalulate if key in Javascript object

Sometimes you want to find if a JS object has a property but don't necessarily care what the value is. Use the in operator.

const myObject = { something: 42 };

> 'something' in myObject
> true
See More #javascript TILs
Looking for help? At Hashrocket, our JavaScript experts launch scalable, performant apps on the Web, Android and iOS. Contact us and find out how we can help you.