Most voted "prototype" questions
In prototypic inheritance, the prototype (prototype) of an object is the basis that provides the initial properties and methods of an object, before it adds its own and perhaps customizes existing ones. Other objects in turn can use it as a prototype, forming a hierarchy known as the "prototyping chain". Note: For questions about prototyping systems in general, use the tag "prototyping".
Learn more…24 questions
Sort by count of
-
61
votes1
answer1802
viewsHow do prototypes work in Javascript?
It seems to me that the concept of prototype is fundamental in Javascript and even in several places I have read that is one of its strengths. However, this does not seem such a simple concept to…
-
37
votes5
answers7326
viewsIs Javascript an Object-Oriented language?
Many say that it is not an object-oriented language, because it is not possible to define classes in it, until its version Ecmascript 5, but with the use of constructing functions and prototyping it…
-
23
votes2
answers2433
viewsWhat is Javascript Prototype?
I see in various instances of native objects a '.protoype' in the middle before a method or attribute but I don’t know what they are EXACTLY. The only thing I know is that it’s Javascript’s way of…
-
10
votes1
answer237
viewsWhat is Prototype Pollution?
I use a tool that performs security checks on the packages of my project, it indicated me that one of the packages is susceptible to Prototype Pollution, would like to know: What exactly is…
-
9
votes2
answers245
viewsConfused about the correct form of Inheritance in Javascript
I am studying ways to apply Object Orientation in Javascript. I realized that there are several ways to do Inheritance in Javascript. I did the one that I thought was simple and worked. But is it…
-
8
votes2
answers157
viewsWhy copy the prototype method instead of using directly?
I was confused when I saw a certain javascript library code - the undescore.js. I don’t really remember the code part, but it was something like what I saw. var filter = Array.prototype.filter; var…
-
8
votes1
answer147
viewsWhat is the equivalent of Python’s dir function in Javascript?
I was looking for a javascript function equivalent to the function dir python. In Python, if I want to see all methods associated with a given object, just pass the function dir directly to…
-
7
votes2
answers191
viewsWhat are the main differences between prototype-oriented programming and class-oriented programming?
After learning a little more about Javascript, I realized that even though I have a building class, classes (in fact, as in C# or Java) do not exist in Javascript. This is nothing more than…
oop classes characteristic-language language-independent prototypeasked 4 years, 3 months ago Luiz Felipe 32,886 -
6
votes2
answers144
viewsHow does changing the prototype of the String.prototype.toString() method affect this code in Javascript?
I couldn’t understand why the method reverse is applied in the string "abcde" (over-written in toString) and not in "12345". String.prototype.reverse = function() { return…
-
5
votes1
answer67
viewsHow to pass argument to Object prototyped with prototype?
With this of to do this: function Biscoito(sabor,marca,preco) { this.sabor = sabor; this.rodas = marca; this.preco = preco; this.mostrarAtributos = function(){ return sabor + ", " + marca + ", " +…
-
5
votes1
answer86
viewsIn what situations use each prototype type in HTML elements?
In "prototypes" I have used several times the Element.prototype and the HTMLElement.prototype. I wanted to know what is each and what is the difference between them in example, if possible. Because…
-
5
votes1
answer185
viewsWhat is the difference between creating an object from the literal form or from a constructor function?
I wonder if it has any difference or relevance between the two forms below in the construction of an object: Create an object from the literal form: let pessoa = { nome: 'Pedro' };…
javascript characteristic-language objects builder prototypeasked 4 years, 10 months ago felipe cardozo 275 -
4
votes0
answers99
viewsWhat is prototype-based programming?
Reading about javascript I came across the term prototyping-based programming, and I also saw that in devmedia claim that javascript is an object-oriented language based on prototypes. Finally I…
-
3
votes2
answers122
viewsHeirs attributes with prototype do not appear in Javascript Reflection
I have the class Animal that has some properties that are enumerable: true, that is, I can list them via Reflection using for..in. So I have the class Coelho that has the attribute cor. How rabbit…
-
3
votes3
answers1139
viewsOrganize alphabetically with indicative header, json
I have the following tree of names in Json: [{"nome":"Alberto"},{"nome":"Cristiana"},{"nome":"Altura"},{"nome":"Ivino"},{"nome":"Otário"},{"nome":"Umberto"}] How do I organize them in alphabetical…
-
2
votes2
answers310
viewsJavascript prototype: possible to change value of reference object?
EDIT: It’s usually at the end, but the question was poorly worded and I decided to switch to this example that is much better. Follow the example of a function that does nothing as an array method:…
-
1
votes2
answers71
viewsModify an HTML element or a browser native function
Guys, next... Google Core supports the element <dialog> and its functions showModal() and close(). However, some browsers do not support it. I made a simple script, which checks whether the…
-
1
votes1
answer58
viewsDoubt to access this in prototype
I am trying to access some variables within this (Object Orientation) using Object.prototype, but at a certain point I am in doubt if I am doing it correctly: This and the main function: function…
-
1
votes1
answer37
viewsthis is assuming the value of Window
I don’t know what’s wrong with this code. Inside the function builder EvilCircle, the this works well, but in EvilCircle.prototype.draw doesn’t work. It looks like it turns into Window. function…
-
0
votes2
answers8899
viewsCannot read Property '0' of Undefined, prototype incompatibility
I am using a script that sorts a JSON in alphabetical order with indicative header, as shown in this question however I am not able to make it work in harmony with prototype, returns me the error:…
-
0
votes1
answer236
viewsWhat is the difference between Text Box and Input?
I’m making a medium fidelity prototype in the Pencil app and would like to know the difference between a Text Box field and Input and when to use them: Thank you!…
-
0
votes0
answers24
viewsProblem with dynamic element creation
I am developing an application that uses a lot of Jquery, since there are several very specific functions. But for reasons of customization and optimization, I managed with the mix of some…
-
0
votes1
answer43
viewsThis altering var global
I am making a change within the array of the object’s main function, but this is changing several values, including variable outside the object, which cannot happen. How can I fix this? var…
-
0
votes1
answer32
viewsMultiple Prototypes
I would like to know how to add a prototype to a function that is already instantiated in a prototype. Example below: app js. 'use strict'; function NivFire(){ this.db = "", this.admin = "",…