Once that object is assigned to a variable (say foo
) you’d be able to print text2
value by doing:
var foo = {
"text1": "item_1",
"text2": "item_2",
"text3": "item_3",
"text4": "item_4"
};
console.log(foo.text2);
Regarding how faster is JS over jQuery, this is a very simple instruction and there won’t be a significant difference between one or the other.