//optional array to object
var object = Object.assign({}, data);
var object = ['apel', 'mangga', 'jeruk']
const allowed = ['mangga'];
var filtered = Object.keys(object)
.filter(key => allowed.includes(key))
.reduce((obj, key) => {
obj[key] = object[key];
return obj;
}, {});
data = filtered;
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter