I have an array of food categories, and I want to pair each category to a list of product codes that are in an array of arrays.
const categories = [ "dairy", "fruit", "breakfast", "frozen" ];
const codes = [['2340', '89878', '9998'], ['89878'], ['987979', '984', '29898', '299'], ['0008', '2988'}]
categories and codes both have 10 elements each. How can I end up with ...
const onSale = {dairy:['2340', '89878', '9998'], fruit: ['89878'], breakfast:['987979', '984', '29898', '299'] , frozen: ['0008', '2988'}
Im a newbie, so Vanilla JS preferred.