diff --git a/site/content/docs/01-component-format.md b/site/content/docs/01-component-format.md index 050b88f5c7..ddd2667075 100644 --- a/site/content/docs/01-component-format.md +++ b/site/content/docs/01-component-format.md @@ -47,7 +47,7 @@ Svelte uses the `export` keyword to mark a variable declaration as a *property* // Values that are passed in as props // are immediately available console.log(foo, bar); - + // Function expressions can also be props export let format = (number) => (number.toFixed(2)); diff --git a/site/content/docs/02-template-syntax.md b/site/content/docs/02-template-syntax.md index db95da2794..aabcf1f2f3 100644 --- a/site/content/docs/02-template-syntax.md +++ b/site/content/docs/02-template-syntax.md @@ -188,18 +188,19 @@ If a *key* expression is provided — which must uniquely identify each list ite --- -You can freely use the destructuring pattern in each blocks, the rest syntax being supported. +You can freely use destructuring and rest patterns in each blocks. -```sv -{#each items as {id, name, qty}, i (id)} +```html +{#each items as { id, name, qty }, i (id)}
  • {i + 1}: {name} x {qty}
  • {/each} -{#each objects as {id, ...rest}} -
  • {id}
  • +{#each objects as { id, ...rest }} +
  • {id}
  • {/each} + {#each items as [id, ...rest]} -
  • {id}
  • +
  • {id}
  • {/each} ``` @@ -1358,4 +1359,4 @@ The `` element provides a place to specify per-component compile ```html -``` +``` \ No newline at end of file