I have an object called at.sports.
And my object contains two fields: sporttype - string , and team which is an array ...or another object.
it's something like this:
at.sports = {
sporttype : "Soccer"
team : [
{ name : "bayern FC",
caption: "FCB"
}
]
}
If i check the structure in visual studio i get:
at.sports = {
proto: {},
sporttype: "Soccert"
team: object Object
}
and if i click on team.. i see
0 - name - "arsenal" , caption - "Asnl" 1 - name - "bayern FC" , caption - "FCB" I want to access the team property.. check every index (0,1) for caption and see if is set. If caption is undefined.. i want to replace it with the value of name and than capitalize the first letter.
ex: for index 0 if i have only name ="arsenal" and caption unset , i need that caption to become "arsenal", and than capitalize first letter .. so at the end caption = "Arsenal" .
I really don't know how to .. get my hands on the right property and modify.
And i'm very curious.. the team property.. is an object or an array? i think it's an object because i get object Object in Visual studio when i click on at.spors ...
Oh..trust me..i researched on google. I just don't understand how to access what i need from inside at.sports.
After i acces what i need..i see there is a method for capitalize.. and it's easy to change a property value with other value. I get errors in for statement.
I tried this:
for (var i = at.sports.length; i--;) {
if (typeof at.sports.team[i] === "undefined") {
alert("something is undefined");
}
}
And i get the alert 2 times. I have 2 indexes. So..i'm thinking the problem wrong.