Can anyone assist me in extracting an array of numbers from an array of objects with string values as properties? Below is an example of the array:
scores = [
{
maxScore:"100"
obtainedScore:"79"
passed:"pass"
subject:"Maths"
},
{
maxScore:"100"
obtainedScore:"73"
passed:"pass"
subject:"Science"
},
{
maxScore:"100"
obtainedScore:"82"
passed:"pass"
subject:"English"
}
]
I would like to extract obtainedScore and maxScore from these objects and store them in two different arrays.
Here is what I attempted:
for (var i =0 ; i < score.length; i++)
{
var marks[i] = parseInt(score[i].obtainedScore) ;
}
However, this resulted in returning NaN.