How to remove double quotes in shortcode

I’m trying to make a dynamic JavaScript function in the shortcode:

<script>
	carousel_{{$class}}(1, '{{$class}}');

The HTML source shows the double quotes are retained.

<script>
	carousel_"slider316"(1, 'slider316');

I don’t want the double quotes around my variable slider316.
What is the easiest way to remove the double quotes?

Thanks.

the script tag switches to the doublequotes
this works:

{{% carousel blabla %}}

shortcode carousel.html:

<script>
{{ $class := .Get 0 }}
{{ safeJS (printf "carousel_%s" $class)}}(1,'{{$class}}');
</script>

Result:

<script>
carousel_blabla(1,'blabla');
</script>
2 Likes

Thank you ju52. safeJS worked great.