Here is a snippet and link to my favorite example that you can use to understand this in JavaScript. Make sure you have the console open and read the logs as you click on the buttons.

Here is a snippet and link to my favorite example that you can use to understand this in JavaScript. Make sure you have the console open and read the logs as you click on the buttons.