How to get data attribute from element in JavaScript

DOM
Last updated Jul 28, 2018
<div id="box" data-user-id="123"></div>
const box = document.querySelector("#box");
const userId = box.dataset.userId;
123