1Values in JavaScript
2To use the values of custom properties in JavaScript, it is just like standard properties.
3// get variable from inline style
4element.style.getPropertyValue("--my-var");
5
6// get variable from wherever
7getComputedStyle(element).getPropertyValue("--my-var");
8
9// set variable on inline style
10element.style.setProperty("--my-var", jsVar + 4);
11