How to check if element has class in JavaScript

DOM
By Jad Joubran · 
Last updated Dec 01, 2019
<div id="box" class="active"></div>
const element = document.querySelector("#box");

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