Using script how set value varible value

Hello, Everyone any way to set edge variable into script tag like when I select any value then script tab into set variable value

<script>
// Dynamic data
var data =[{ id:1,name:"Test"}]
</script>

<select>
@each (it in data)
<option value="{{it.id}}">{{it.name}}</option>
@endeach
</select>

this possible or another way to set variable ?

Use @set

I try but not work

Let’s see your implementation.

@each (it in data) {{it.name}} @endeach

Can’t see where you used @set()