How to check if element has class in JavaScript

DOM
Last updated Aug 24, 2018
<div id="box" class="highlighted"></div>
const element = document.querySelector("#box");

element.classList.contains("highlighted");
true