Ever used self calling object methods in JavaScript???

👇 Read More about explanation below
#javascript #programming #100DaysOfCode #CodeNewbies
In the sample above, there is an object named person and the person object has 3 keys (fullName, personality and age)...
-age is a property so it can directly be accessed as person.age
-personality is a method. It stores a function. So it can be accessed as person.personality()
-fullName on the other hand also contains a function but the function definition is followed by a pair of parentheses "()". The function will call itself and then return a value. The value is stored in the fullName key. So you can write person.fullName not person.fullName()
The fullName key can then be accessed as a property. Some limitations apply.
👉 The 'this' keyword is not available in it.
👉 The function should return a value to be stored in the key so the key can be accessed as a property.
Kindly follow @AbdulramonJemil if you haven't. Thanks
I used array destructuring on line 1 in the code snippet...
If you don't know what that is, read this thread... https://twitter.com/AbdulramonJemil/status/1387993754498383875?s=19
You can follow @AbdulramonJemil.
Tip: mention @twtextapp on a Twitter thread with the keyword “unroll” to get a link to it.

Latest Threads Unrolled: