diff --git a/site/content/docs/01-component-format.md b/site/content/docs/01-component-format.md index 1472ff3d6c..ddd2667075 100644 --- a/site/content/docs/01-component-format.md +++ b/site/content/docs/01-component-format.md @@ -47,11 +47,14 @@ 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 declarations cannot be set externally, - // but can be accessed from outside - export function instanceMethod() { - alert(foo); + + // Function expressions can also be props + export let format = (number) => (number.toFixed(2)); + + // Function declarations are added as methods + // on the component, rather than props + export function greetMethod() { + alert(`I'm a <${this.constructor.name}>!`); } // you can also use export { ... as ... } to have