If I have an object and function
var obj {
"1234": {"example": "sample"},
"5678": {"example": "sample"}
}
function example(num, str) {
if obj[num].hasOwnProperty(str) {
//manipulate property
}
return obj;
}
then later call the function,
obj(1234, "example")
Why do I have to write obj[num] instead of obj.num? Shouldn't dot notation be acceptable because the value being passed will always be an integer and not have quotations around it, i.e. obj.1234 would work but not obj."string"?
var obj = { 1234: {"example": "sample"} ...