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 …

How to create a prototype for this type of constructor?

I explore the deep end of JavaScript. Well, let’s say I have a constructor function like this. Yes, I know this is a weird way of creating a constructor function, but … function Animal(name){ …

Isn’t polymorphism works wrong in JS ES

I’m currently working on a browser extension to manage opened tabs and I notice that in JS ES polymorphism works a bit strange when I declare class fields at the top of the class. Let say that we want …

Concatenative inheritance vs class inheritance in JavaScript

concatenative inheritance works like a composition to me when I look to it at the beginning, but people keep naming it as an inheritance. classes, however, use the prototype to create a prototype …

In Javascript, what does this underscore mean?

I’m reading a tutorial on backbone.js here: http://addyosmani.com/blog/building-spas-jquerys-best-friends/ What are the underscores? (_index, _photos, _album) Why use them? Answer It means private fields or private methods. Methods that are only for internal use. They should not be invoked outside of the class. Private fields contain data for internal use. They should not be read or written into (directly) from outside of the class. Note: It is very important to note that just adding an underscore to a variable does not make it private, it is only a naming convention.

How to get a JavaScript object’s class?

I created a JavaScript object, but how I can determine the class of that object? I want something similar to Java’s .getClass() method.