You can directly used the variable in script tag in sightly using sightly context based on your requirement. Or you can also try using JS API as mentioned by smacdonald2008
<script>
var variable = '${properties.variablename @ context="scriptString"}'; // This can be used in javascript included after it as it is available as global variable