concept variable in category svelte

appears as: variable, variables, variable, The variables
Svelte and Sapper in Action

This is an excerpt from Manning's book Svelte and Sapper in Action.

This works, but it’s a bit verbose. We can do better using the Svelte bind directive. You will see many uses of the bind directive later, but one use is to bind the value of a form element to a variable. This causes the form element to display the current value of the variable. If a user changes the value of the form element, the variable will be updated to match.

myArr = myArr.concat(newValue);
 
myArr = [...myArr, newValue];
 
myArr.push(newValue);
myArr = myArr;
<script context="module">
  ...
</script>

When a script element doesn’t specify its context, it is instance context. One of each kind of script element, module and instance context, can appear in a component source file.