I have an array,
var test = [{
id: 0,
test_id: "Password test",
pass: 1,
fail: 5,
time: 0.03,
pass_fail: 20,
comments : [
{comment : "a comment", commentuser : "user" },
]
};
]
within I want to get the value of comment and commentuser in the object comments. I tried as follows,
JSON.stingify(test.comments) // output : "{"comment":"a comment","commentuser":"user"}"
Is there a way to just get the value ? wanted output : "a comment,user"
Cheers
var comment = test[0].comments[0].comment; var commentuser = test[0].comments[0].commentuser;