Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

check if an object contains a value in javascript

var obj = { a: 'test1', b: 'test2' };
if (Object.values(obj).indexOf('test1') > -1) {
   console.log('has test1');
}
Source by duckduckgo.com #
 
PREVIOUS NEXT
Tagged: #check #object #javascript
ADD COMMENT
Topic
Name
4+9 =