var validation_messages = {
"key_1": {
"your_name": "jimmy",
"your_msg": "hello world"
},
"key_2": {
"your_name": "billy",
"your_msg": "foo equals bar"
}
}
For example, I'd like to see a member of an object. How do you create a repeating sentence that searches for your_name: Jimmy for each key?
javascript object
for (var key in validation_messages) {
// // skip loop if the property is from prototype
if (!validation_messages.hasOwnProperty(key)) continue;
var obj = validation_messages[key];
for (var prop in obj) {
// // skip loop if the property is from prototype
if(!obj.hasOwnProperty(prop)) continue;
// // your code
alert(prop + " = " + obj[prop]);
}
}
Do it like this.
918 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
620 Uncaught (inpromise) Error on Electron: An object could not be cloned
578 Understanding How to Configure Google API Key
574 Who developed the "avformat-59.dll" that comes with FFmpeg?
613 GDB gets version error when attempting to debug with the Presense SDK (IDE)
© 2024 OneMinuteCode. All rights reserved.