The expression count+=1 moved to count++

In most tutorials, people use count++. Now, in the introduction video on the website, the author talks about assignment operation triggering update (the Vue example). Now, what confused me a bit, and made me try the count++ is that, it is obvious that count++ is count = count + 1 or count+=1, but since svelte is a compiler, I was not sure if the compiler, based on the expression of assignment does some work, or not.

That confused me, so it is a good chance that it might confuse other people.
pull/5985/head
Nikola 6 years ago committed by GitHub
parent d3f3ea38d0
commit a9cb1ba540
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -14,8 +14,8 @@ Inside the `handleClick` function, all we need to do is change the value of `cou
```js
function handleClick() {
count += 1;
count++;
}
```
Svelte 'instruments' this assignment with some code that tells it the DOM will need to be updated.
Svelte 'instruments' this assignment with some code that tells it the DOM will need to be updated.

Loading…
Cancel
Save