An API returned an ad item, and the array required lists the fields it must have. Write a function missingFields(item, required) that returns an array of the fields from required that item does not have, in the order of required.
missingFields({ id: 1, price: 500 }, ['id', 'title', 'price'])Returns [ 'title' ]
missingFields({ id: 0, title: '' }, ['id', 'title'])Returns []
Asked at Avito · Source
missingFields({ id: 1, price: 500 }, [ 'id', 'title', 'price' ])[ 'title' ]missingFields({ id: 0, title: '' }, [ 'id', 'title' ])[]missingFields({}, [ 'id', 'title' ])[ 'id', 'title' ]Hidden tests run on Submit.