<!--
from svelte 3.23.1 onwards this issue has been fixed.
see: https://github.com/sveltejs/svelte/issues/4744
-->
<script>
let list = [1, 2, 3];
const changeList = (index) => list[index] *=2
$: console.log('list', list)
</script>
changing item from inside the each block: <br />
{#each list as item}
<button on:click={() => item *= 2 }>{ item }</button>
{/each}
<br /><br />
calling a function from inside the each block that changes the item: <br />
{#each list as item, index}
<button on:click={() => changeList(index) }>{ item }</button>
{/each}