JavaScript is a language with a strong functional-oriented bias, it gives us freedom. A function can be dynamically created, copied to another variable, or passed as an argument to another function and later called from a completely different location.

Don’t worry, I promise that by the end of this article you will have a complete understanding of closures.

First, let’s look at the two situations, and then explore the internal mechanisms step by step so that you can answer these and more complex questions in the future.

  1. The Greet function uses the external variable name. …

1. Computed vs methods

Computed properties actually work like getters, they are usually using to compose new data from existing properties and they don't accept arguments. Computed properties know if the values used in the function changed so they don’t need to run every time to check

Methods are static functions and they are useful for DOM event handling, logic parts. And you can pass arguments to methods. Methods don’t know if the values used in the function changed so they need to run every time to check.

2. Lifecycle hooks (how do they work?)

Specify your properties in the created hook it’s very important because the template hasn't mounted yet…

Ashot Hovhannisyan

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store