var i = "test";
var test1 = {
test: 3,
b: 3
};
console.log(test1.i);
Sorry if it's a simple answer, I am still learning.
var i is looping to something different every few seconds and var i will always be something on test1.
var i = "test";
var test1 = {
test: 3,
b: 3
};
console.log(test1.i);
Sorry if it's a simple answer, I am still learning.
var i is looping to something different every few seconds and var i will always be something on test1.
If you are trying to retrieve a property of an object you can use the .
notation, or the []
notation
var test1 = {
test: 3,
b: 3
};
Using .
notation
test1.test; // -> returns 3
Using []
notation
var propertyName = 'test'
test1[propertyName]; // -> returns 3