how to check some key and if all values of this key are empty
Hi, I've got this code but it's not correct
- var test_h2s = JSON.parse($.cookie('name_of_cookie'));
- JSON.stringify(test_h2s, function(key, value) {
// when encoutering one of the keys we're looking for, with all values empty
while(key.substr(0, 3) === 'h2s' && value !== "") {
//do something
}
});
- I've to check if all keys with starts their name with "h2s" have all values empty
in json after parse
{"h2s":"on","h2s_perc":"dffdfd","h2s_Humidity":"fdfd","h2s_Temperature_avg":"fd","h2s_Temperature_min":"fdfd","h2s_Temperature_max":"fdfdf","h2s_Gas_umidity":"dfdfd","h2s_Content_Inlet":"fdfd","h2s_Content_Outlet":"fdfd"}
- Many thanks