DEV Community

Discussion on: Svelte tutorial note

Collapse
 
murunwas profile image
murunwas • Edited

But I tried it without $ prefix as shown below but still works.

export const elapsed = derived(
    time,
    t => Math.round((t - start) / 1000)
); 

The $ prefix is used to show that the variable is observable, you can omit it

Collapse
 
dance2die profile image
Sung M. Kim • Edited

Thank you for the confirmation of the behavior.

Oh yes. as that got me confused, I asked and someone replied that even Svelte test code uses the callback without $.

reddit.com/r/sveltejs/comments/hbl...