About Sass Variables in JavaScript

You can pass Sass variables to JavaScript using CSS custom properties as follows:

Sass:

$theme_color: #215a00;

:root {
    --theme-color: #{$theme_color};
}

JavaScript:

const themeColor = getComputedStyle(document.body)
    .getPropertyValue('--theme-color');

Tips and Tricks Programming JavaScript CSS3 Sass