🎨 Frontend
JavaScript
Weird Function Class

Weird Function as a Class

Recently I trained myself with Hackerrank. I tried to take the Intermediate JavaScript certificate, but I was not too interested. I just want to make myself more often and adapt to the Hackerrank environment because I usually train at LeetCode. I thought they were giving multiple-choice questions to test my knowledge in JavaScript, but turns out it's not. They just gave two questions which are (1) you need to implement a class from given conditions. (2) It's the same but with inheritance behavior. So, you need to implement two classes which are dependents. In addition, it's not a normal class but you need to implement a function as a class. This is quite interesting.

As far as I know, this is old technology because there is class syntax which is far easier than this. Also, TypeScript's presence makes class more powerful like many programming languages did.

reference (opens in a new tab)