You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
svelte/test/runtime/samples/const-tag-each-arrow/main.svelte

22 lines
292 B

<script>
export let tags = [
{
name: 'Red',
color: '#FF0000'
},
{
name: 'Green',
color: '#00FF00'
},
{
name: 'Blue',
color: '#0000FF'
}
];
</script>
{#each tags as tag}
{@const tagColor = tags.find(t => t.name === tag.name).color}
<p>{tagColor}</p>
{/each}