In this blog post, I am going to explain how to use dependency injection in spring using setter injection and Java configuration. This blog post assumes you already have Java…
22
There are multiple ways to iterate/loop through all the properties in a JavaScript object.
Method 1: for-in loop
var person = {
name: 'Shravan Kasagoni',
age: 20,
isActive: true
};
person.constructor.prototype.printName = function() {
console.log(this.name);
};
person.constructor.prototype.encKey = 'somevalue';
person.constructor.prototype.printName = function() {
console.log(this.name);
};
The for-in loop iterates over all enumerable properties of an object.
for (var propertyName in person) {
console.log(propertyName, person[propertyName]);
}
Result:
name Shravan Kasagoni
age 20
isActive true
printName ƒ () {
console.log(this.name);
}
encKey somevalue