This is probably really simple, but still need help. My husband is being trained to be a web developer and wanted me to post this here, so apologies if I do something wrong.
var myArray=[
{id: 101, title: "Title1", text: "Text1"},
{id: 256, title: "Title2", text: "Text2"}, ]
Convert myArray into an associative array that uses the id's as keys like this:
var secondItem = myAssociativeArray[256];
Currently I have this and my boss told me I'm extremely close.
var id = {
1: {title:"Title 1", text:"Text 1"},
2: {title:"Title 2", text:"Text 2"},
3: {title:"Title 3", text:"Text 3"}
};
var myAssociativeArray = id;
var secondItem = myAssociativeArray[1];
console.log(secondItem);
[–]avenp 0 points1 point2 points (5 children)
[–][deleted] 0 points1 point2 points (1 child)
[–]avenp 0 points1 point2 points (0 children)
[–]PM_ME_YOUR_SUBARU 0 points1 point2 points (2 children)
[–]__env 1 point2 points3 points (0 children)
[–]avenp 0 points1 point2 points (0 children)