Skip to content

Tag: oop

JavaScript – Classes are special Functions?

Coming from a Python background, I’ve read this, learning Javascript: Classes are in fact “special functions”, and just as you can define function expressions and function declarations, the class syntax has two components: class expressions and class declarations. on dev.mozilla website.. Wh…

Overriding super method in TypeScript

I’m trying to overload/override a class method in TypeScript, where the superior method takes zero arguments and the subordinate method takes one. My TypeScript code is similar to the following: This code produces the following error: Why doesn’t this work? It it because the transpiled JavaScript …

How to extend class type with decorator

I’d like to use decorators in my project. Here’s what I have written: As you see this decorators creates a few fields. But typescript can’t recognize them It does exsist though. If I add @ts-ignore before using these parameters, the code works okay. I wounder, how can I create a class decora…

Different output from prototype function and normal function

I’m trying figure out what’s the difference between prototype function and normal function here’s my example: Task is to create function in ‘OOP way’ that will check if string is Uppercased. Why im getting different output? Answer this.toString() will do the trick for you. &#8220…