Most voted "objects" questions
An object is any entity that can be manipulated by commands in the programming language. An object can be a value, a variable, a function, or a complex data structure. In object-oriented programming, an object refers to an instance of a class.
Learn more…360 questions
Sort by count of
-
0
votes1
answer217
viewsMerge the values of an Array inside another Array
I have several Arrays throughout the program to check identifiers Soon in a function I check a include to know if a particular identifier is inside an object the object has the following format {…
-
0
votes1
answer375
viewsJoin objects with equal values with Javascript
I have an array of objects. I want to join objects that have similar values using Javascript. const teste = [ { Hora: '23:49:08.277', CodigoDoPiloto: '038', Piloto: 'F.MASSA', Volta: '1\t\t',…
-
0
votes1
answer44
viewsUnintentionally changing the value of the object
Project link: https://github.com/ThomasCaio/RPG2 self.enemy.Damage returns : {'Physical': 45, 'fire': 25} self.Defense returns : {'Physical': 50} def receive_damage(self): damage = self.enemy.damage…
-
0
votes1
answer76
viewsSort on an object [java]
Cheers guys, I’m having a doubt about a project I’m doing just to learn more about the language. following, I have a txt file in which I have to read it and separate the different contents (name,…
-
0
votes0
answers200
viewsTag OBJECT html does not load PDF mobile content
I have a problem using the html Object tag. The documentation says it has support, but when trying to load the pdf on mobile, it does not load, only on the desktop. I tried with image to see the…
-
0
votes2
answers238
views -
0
votes1
answer851
viewsScan array via javascript and remove duplicate objects with Map
I’m going through the following JSON: [ { "amount": 6, "codes": [ "BRCH", "ARSI", "ENSI" ] }, { "amount": 6, "codes": [ "BRCH", "ARSI", "ENSI" ] }, { "amount": 6, "codes": [ "BRCH", "ARSI", "ENSI" ]…
-
0
votes1
answer153
viewsJavascript - How do I pass a json object in my class constructor?
Good afternoon, I have a question regarding parameters where you pass an object, for example in mongoose has a method connect which we passed to url connection + a objeto to define the options, and…
-
0
votes1
answer40
viewsDuplicate Array in Function
I created a script where inside my object it would calculate the percentage of an array, in this same object it contains a function that calculates the sum of my percentage with my array. However…
-
0
votes1
answer151
viewsHow to get the items inside an Object(stdClass) in PHP?
I’m importing with PHP for an api, and I don’t know how to get the values of object(stdClass) who are inside the $fotos. I tried it both ways below, but I believe I’m wrong: foreach($fotos as $f){…
-
0
votes0
answers52
viewsHow do I step by parameter in "literal template" the name of a specific property of an object in Javascript?
My question is this: I intend to eliminate a specific object through a property tech which I defined, which stores the technology as I add through an HTML form. I created an empty array const…
-
0
votes0
answers23
viewscomparing javascript objects
to compare objects in javascript, I could turn these objects into strings and then compare them? would the result be correct? follows below what I did: let equalsString = (a, b) => { let…
-
0
votes1
answer117
viewsHow to get the next attribute of an object array?
Good night, guys, so I’m locked in a code here. I have an array of objects, and I will receive an input name, which is found in one of the "display" objects of the array below, for example "Márcio…
-
0
votes1
answer1695
viewsHow to add values of an object array[JS], with only functions and loop for?
That is the question: Sum of expenditure and revenue Create a program that calculates the sum of revenue and expenses of users and at the end returns the balance (revenue - expenses). Use the user…
-
0
votes1
answer64
viewsEmpty object javascript
Hello I have a function that returns an Object with several functions inside, I need this object to be returned as string, but when I do the JSON.stringfy() it returns an empty object. Can someone…
-
0
votes1
answer88
viewsHow to show the name of all arrays inside an object?
I’m making a search system and with a problem to show the name of the arrays inside the object. The object is in this style: let item = { descricao: "Casa", id: 123, localizacoesFilho: [ {…
-
0
votes2
answers37
viewsHow to pass method objects that are in different controllers in Laravel?
Good night. What I need is to display the name of the book where your id is (in the Form Book column). And so that I don’t do it in a way outside the convention, I’d like to know the right way to do…
-
0
votes1
answer38
viewsLoop repeating works in one case, but does not work in another (JS)
I am not able to understand why the loop below works to assign a new value to the index, but does not work to change the property of an object. What I did wrong, you guys? var p = ["teste1",…
-
0
votes1
answer822
viewsHow to resolve error C# "Nullreferenceexception: Object Reference not set to an instance of an Object."?
I’m trying to finish a project only that is showing error on the foreach part, and in VSCODE does not report any problem. I’m learning C# now and I can’t figure it out on my own. this is…
-
0
votes1
answer64
viewsHow to create property in a Python object?
How can I create an object with property and add to an object list using python? I have a funtion that expects a return from a list of products, this return is used by other futions and do not want…
-
0
votes2
answers97
viewsReact components that receive ownership of an object as content do not update, how to deal with it?
I basically have a state that is a complex object and several components that render only one property of it, as the application is kind of large I made this prototype to illustrate: //Component…
-
0
votes0
answers25
viewsErrors when rendering a Sectionlist with an object array
I’m trying to insert a SectionList, but is returning in the console, in order, the following errors: Uncaught TypeError: Cannot read property 'length' of undefined The above error occurred in the…
-
0
votes0
answers27
viewsObject using object
I have created character objects that will launch data to validate their actions. It is possible the object mago, for example, use the function dado.sorteio()? mago = { nome: "Misha", vida:50,…
-
0
votes0
answers27
viewsRemove element from inside an object
I was needing a help with object manipulation, I have this simple html with a form and a table where are listed the form entries that will be sent to the database, In this activity I unfortunately…
-
0
votes1
answer37
viewsFilter objects within a hashed array
I am creating a program in JS plantation control and add() function, I want to add a filter to check if that hash (name) already exists, however, I am not getting: let data = []; let name = {};…
-
0
votes0
answers21
viewsJavascript - Array of various objects, but with content
The problem in question is that I do the request, I receive the data, I push the data inside an instantiated array at the beginning of the code, but when I go to see this array, it says it’s empty,…
-
0
votes2
answers56
viewsHow to pass a specific object as props in a generation of components?
Hello, I’m initiating the studies in React and when trying to create a code that generates components (in this case the "Box")where at the click of a button passing objects coming from a state to a…
-
0
votes1
answer26
viewsaddeventlistener click event for after finding object type item in array - Javascript
I have the following situation: an html and inside that html a DIV, I am including via js 3 images in this div with innerHTML (like a Carousel) that change according to the button and their position…
-
-1
votes1
answer1071
viewsUpdate component/Angular Object 6
I have 3 components that exchange an Object among themselves, as I do for when updating one another also upgrade alone? Example: I have components 1, 2 and 3, 1 calls 2 passing an Object and 2 calls…
-
-1
votes1
answer343
viewsDictionary for objects in Python
I wonder how I can assign a dictionary to a set of objects. For example, I have a 4x4 vector of 'neuron' objects': [[<__main__.Neuronio object at 0x1035644e0>, <__main__.Neuronio object at…
-
-1
votes1
answer56
viewsPopulate input with object value via the key dynamically
I have a spreadsheet where I need to automatically fill a field from the value entered in another field, where the base is the values of an object. Example: I have the object: objeto = { 10:0.9997,…
-
-1
votes1
answer97
viewsJoin two objects in another object
Eae guys wanted to know how to pick up two objects and put everything together in a third object I speak two objects because the angular is saying that they are objects and not arrays. var obj1 =…
-
-1
votes1
answer65
viewsSelect items and sort objects list
I’m learning how to use the Github API and for that I took a user to use as an example. I am getting a list of objects and need to select the names of the 3 oldest items and leave them in ascending…
-
-1
votes2
answers1617
viewsForeach in Javascript
Hello, I have an object in JavaScript and would like to check if all the values of the object keys are different from null, undefined, 0, "" and " ". I traverse each value of my object through the…
-
-1
votes1
answer77
viewsYou doubt Function and Length?
Good evening Everyone, I would like to help with the following code: function tamanhoNomeCompleto(nome, sobrenome){ return (nome + " " + sobrenome).length; } tamanhoNomeCompleto("Lucas", "Paixao");…
-
-1
votes1
answer115
viewsComparison of object attributes within a for loop
How to compare a single item of an object that has 3 spaces or more? I want to make a system that, every time the login is equal to some that is already stored in some object, appears an alert…
-
-1
votes1
answer36
viewsInvoking methods within an Arraylist does not recognize the object method
I try to invoke the method through the method get().getNome(), but says that the method does not exist.…
-
-1
votes1
answer2163
viewsHow to access individual object values in array?
I’m trying to access some specific values of an object within an array, from a get method response using Xios. I’d like to access id, dateTime, sensorData etc of each array object separately, for…
-
-1
votes2
answers44
viewsUse the class to add the object itself into a vector that stays in another object
In python I made the following code: class Escola: def __init__( self, escola_nome ): self.escola_nome = escola_nome self.alunos = [] class Aluno: def __init__( self, nome ): self.nome = nome…
-
-2
votes2
answers3399
viewsAdd a new literal object to an object array!
I would like to add a new item to my object array through a method, but I don’t know how to do it. public products: Array<Object> = [ {prodName: 'product 1', prodElement: 'element 1',…
-
-2
votes1
answer45
viewsHow do I display attributes of an object stored in an array?
I’m doing a job that consists of fictitious real estate. In this program there is a class called principal where it receives Immovel (Class) and stores the immovables in a vector, a class…
-
-2
votes1
answer115
viewsHow to add 2 objects and return number, in Python?
I have the following class: class num(int): def __init__(self, n): self.n = n I would like it to work as follows: A = num(2) B = num(3) A + B = 5 This is part of a much more complex personal…
-
-2
votes2
answers59
viewsApply equal properties to different JS objects
I would like to know how do I encapsulate identical properties that are being assigned to different objects. For example: In my code, there is a 'first' object, which is located inside a class, and…
-
-2
votes2
answers93
viewsHow to Loop a Java Object
An object does not have the same behavior as an object during a Javascript loop. That example: let obj = { casa1: { cor: 'azul', quartos: 2, }, casa2: { cor: 'vermelho', quartos: 4, }, } Does not…
-
-2
votes1
answer34
viewsArray size within an object
Hello, I’m doubtful on how to count the values found inside an array, which is in an object. Thanks for your help. let spendin={ recipes:[2000,5000,400], expenses:[8000] } function saldo(spendin){…
-
-2
votes1
answer37
viewsHow do I return the property of a class to an object of a function?
class Servidor{ constructor(ip, port){ this.ip = ip this.port = port this.admin = true } getPropert(){ return { // o erro está aqui this.port, this.admin, this.ip } } } My goal was to do the job…
-
-2
votes1
answer41
viewsHow to create a class that contains a list of objects of a parent class?
I need to create a person class that will have attributes (name, age) and a group class that will contain a list of objects of the person class. However I do not know how to do the second class...…
-
-2
votes2
answers142
viewsHow to sort an object with Javascript?
I’m creating a function that takes elements from a . json file and creates options for a select in HTML dynamically. This file is ordered, but when it is presented in HTML it is disordered. Example…
-
-2
votes1
answer244
viewsHow to copy an object array in Javascript?
I have an array of objects and need to create a function that takes this array and returns a new array with new modified objects. See the example below: function increase_age(users) { for (user of…
-
-2
votes1
answer74
viewsHow to flatten a nested object that may contain repeated Javascript keys?
I am trying to transform an array of objects in which each element is like this: { id: 1, maxiTempo: 30, todos: { contar: 2, porcentagem: 1 }, perdeu: { contar: 4, porcentagem: 1.3 }, ganhou: {…