Complete the code to bind the input value in Svelte.
<input type="text" bind:value=[1] />
In Svelte, binding the value of an input to a variable like name allows two-way data binding.
Complete the code to handle a button click event in Svelte.
<button on:click=[1]>Click me</button>In Svelte, event handlers are passed as references without parentheses.
Fix the error in the Svelte code to conditionally render a paragraph only if show is true.
{#if [1]
<p>Visible content</p>
{/if}The {#if} block should check the variable directly to render content conditionally.
Fill both blanks to create a reactive statement that updates double when count changes.
<script> let count = 0; let double; $: [1] = [2] * 2; </script>
count.The reactive statement assigns double to twice the value of count.
Fill all three blanks to create a Svelte component that dispatches a custom event with detail when a button is clicked.
<script> import { createEventDispatcher } from 'svelte'; const dispatch = createEventDispatcher(); function handleClick() { dispatch('[1]', [2]); } let [3] = 'Hello'; </script> <button on:click={handleClick}>Send</button>
The event name is message, the detail is an object with text from greeting variable.