I'm trying to iterate through all objects inside the instance of an object using pure JavaScript.
I tried something like this:
function a(){
this.iterate = function(){
for (var obj in this){
console.log(obj);
}
}
}
var A = new a();
A.insertedValue = 20;
A.iterate();
When doing this, instead of logging for example "20" for insertedValue it simply logs the name of the variable like "insertedValue".
Is there either a better way of looping through all objects in an instance of a object or a way to get the values from the objects I'm looping through?