Get the data attributes of a DOM element with javascript

<div id="aDiv" data-foo="bar">
const cell = document.getElementById('aDiv');
console.log(cell.dataset); // returns DOMStringMap {foo: 'bar'}