Complete the code to create a reactive variable in Svelte.
let count = 0; function increment() { [1]; }
In Svelte, you update reactive variables directly by assignment, like count += 1.
Complete the code to bind an input value to a variable in Svelte.
<input type="text" [1]={name} /> <p>Hello, {name}!</p>
Svelte uses bind:value to create two-way binding between input and variable.
Fix the error in the Svelte component to conditionally show a message.
{#if [1]
<p>Welcome back!</p>
{/if}In Svelte, you use the variable name directly in the {#if} block without calling it as a function or using this.
Fill both blanks to create a reactive statement that updates doubled when count changes.
<script> let count = 0; let doubled; $: [1] = [2] * 2; </script>
The reactive statement uses $: doubled = count * 2; to update doubled whenever count changes.
Fill all three blanks to create a Svelte component that loops over items and shows their names.
<script>
let items = [
{ id: 1, name: 'Apple' },
{ id: 2, name: 'Banana' },
{ id: 3, name: 'Cherry' }
];
</script>
<ul>
{#each [1] as [2] ([3])}
<li>{item.name}</li>
{/each}
</ul>The {#each} block loops over items as item using item.id as a key.