Svelte · Middle · Question 64 of 75
Can <select bind:value> hold objects, not just strings?
<select bind:value={selected}>
{#each users as user}
<option value={user}>{user.name}</option>
{/each}
</select>- ✓Correct answer: Yes: an option's
valuecan be any value andselectedgets the object itself - 2No: only strings are allowed
- 3Only with
JSON.stringify
Explanation
With <select multiple> the bound value is an array.