Recall & Review
beginner
What is the purpose of the <script> section in a Svelte component?
The <script> section holds the JavaScript code for the component. It defines variables, functions, and logic that control the component's behavior.
Click to reveal answer
beginner
What does the markup section in a Svelte component represent?
The markup section contains the HTML-like code that defines what the component displays on the screen. It can include dynamic expressions using curly braces {}.
Click to reveal answer
beginner
How is the <style> section used in a Svelte component?
The <style> section contains CSS that styles the component. Styles here are scoped, meaning they only apply to this component's elements.
Click to reveal answer
intermediate
Can you explain how the three sections (<script>, markup, <style>) work together in Svelte?
The <script> section manages data and logic, the markup section shows the UI using that data, and the <style> section styles the UI. Together, they create a self-contained component.
Click to reveal answer
beginner
True or False: Styles defined in the <style> section of a Svelte component affect all components globally.
False. Styles in the <style> section are scoped to the component, so they do not affect other components globally.
Click to reveal answer
Which section in a Svelte component contains the JavaScript code?
✗ Incorrect
The