// get a button element
const buttonEl = document.querySelector(".example");
// we can retrieve all computed styles with `computedStyleMap`
const allComputedStyles = buttonEl.computedStyleMap();
// forEach will allow us to run code over each prop/val pair
allComputedStyles.forEach((elem, index, arr) => {
// code to run for each pair
});StylePropertyMapReadOnly: forEach() method / notebook
StylePropertyMapReadOnly: forEach() method
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.