Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

forjs check if key in json

var json = {key1: 'value1', key2: 'value2'}

"key1" in json ? console.log('key exists') : console.log('unknown key')

"key3" in json ? console.log('key exists') : console.log('unknown key')
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #forjs #check #key #json
ADD COMMENT
Topic
Name
1+3 =