var map = {};
map[key] = value;
How can I
Creating an object:
tagObject = {};
tagObject['contentID'] = []; // adding an entry to the above tagObject
tagObject['contentTypes'] = []; // same explanation as above
tagObject['html'] = [];
Now below is the occurrences entry which I am affffding to the above tag Object..
ES 2015 standards:
function () {}
is same as () => {}
let found = Object.keys(tagObject).find(
(element) => {
return element === matchWithYourValueHere;
});
tagObject['occurrences'] = found ? tagObject['occurrences'] + 1 : 1;
this will increase the count of a particular object key..