Complete the code to create a reactive block that logs the value of count whenever it changes.
<script> let count = 0; $: [1] { console.log('Count is', count); } </script>
$ without colononMount for reactive blocks:countIn Svelte, a reactive block starts with $: followed by the code to run when dependencies change.
Complete the reactive block to update double whenever count changes.
<script> let count = 1; let double; $: [1] = count * 2; </script>
count on the left side instead of doubledoubleCountThe reactive statement assigns the new value to double whenever count changes.
Fix the error in the reactive block that should log message when it changes.
<script> let message = 'Hello'; $: [1] { console.log(message); } </script>
:messagemessage: which is invalid syntaxThe reactive block uses $: without specifying the variable name after colon.
Fill both blanks to create a reactive block that updates status based on count.
<script> let count = 0; let status = ''; $: [1] = count > 5 ? 'High' : 'Low'; </script>
count on the left side instead of statusmessage or levelThe reactive block assigns status based on the condition involving count.
Fill all three blanks to create a reactive block that updates result with the sum of a and b only if enabled is true.
<script> let a = 1; let b = 2; let enabled = true; let result = 0; $: if ([1]) { [2] = [3] + b; } </script>
b in the condition instead of enableda or b instead of resultb + b instead of a + bThe reactive block checks if enabled is true, then updates result with the sum of a and b.