html get class property

JavaScript
let element = document.querySelector('.preset');
let style = getComputedStyle(element);
let bg = style.backgroundColor;//get array of class names in Javascript
var classesArray = document.getElementById('myElementID').className.split(/\s+/);
Source

Also in JavaScript: