I have 2 css variables “–nav-color” and “–link-color” but it only console.logs my –nav-color only.
let regex = new RegExp('--', 'gim');
for (let i of Array.from(getComputedStyle(document.documentElement))) {
if (regex.test(i)) {
console.log(i);
}
}
i tried multiple methods and one of them is placing console.log(regex.test(i)) after the if but the problem is it also logged the false and true values.