Questions tagged as 'object'

3
answers

What does '' this '' mean when we are working with objects in javascript?

This is an example of my doubt, why put "this" at the beginning instead of just putting "wheels = 4" or "seats = 1", etc. How can this help me when programming? var Car = function() { this.wheels = 4; this.seats = 1; this.engines = 1; };...
asked by 25.06.2016 / 05:23
3
answers

delete an attribute of an object more optimally

I have an empty object defined (associative array) obj = {} If I try to consult some parameter this will return undefined to me because it is empty. >> console.log(obj.id) undefined now I assign a value to id >> obj.id...
asked by 03.08.2017 / 16:47
4
answers

Get object of an array by providing an attribute of the object

I have an array of objects like the following: var nicknames = [] nicknames.push( {id:"100", name:"Juan"} , {id:"200", name:"Mateo"} ); How can I get the data of one of the objects in the nicknames array by supplying the name or the...
asked by 06.12.2015 / 09:28
4
answers

when wanting to create a receipt object "non-static variable this can not be referenced from a static context"

I have a program that should simulate a card game. The Deck class is responsible for creating the deck and shuffling it (Naipe object). When trying to create the object (only one will be created) I get the error of the title. This is my main...
asked by 22.03.2018 / 22:27
1
answer

get the objects that are repeated in an array of JSON objects with javascript (JQuery)

I give as an example the following array of objects in JSON: [{"id":"aaa","uns":"123"},{"id":"bbb","uns":"023"},{"id":"aaa","uns":"123"},{"id":"ccc","uns":"765"},{"id":"ddd","uns":"256"}]. I would like to obtain an array with the repeated...
asked by 06.06.2017 / 10:46
2
answers

Convert URL to Object (JavaScript)

I am working on a personal project (using node.js) where I need to get the route of the GET request, for example "/path/to/content" , transform it into an Object and make it look like this: { "path": { "to": { "content":[...
asked by 27.12.2018 / 17:49
2
answers

Sort object by its indices in JavaScript

How can I sort an object by its indexes in JavaScript, with an object similar to the following {ave:2,gato:3,burro:7,caballo:3,hipopotamo:5,elefante:8} How can I make the object look like this? {ave:2,burro:7,caballo:3,elefante:8,gato:7,h...
asked by 30.09.2018 / 19:03
1
answer

Variable in object path

I'm doing a personal project where I try to recover JavaScript Objects through URL, a kind of RESTful service so I need to convert the routes of my URL in JSON routes to recover the object in question, I do this from the following way:    Tur...
asked by 27.12.2018 / 21:27
1
answer

Hibernate object problem!

Good morning, everyone! I have a problem with the objects in Hibernate. This is the method I use to extract the object: public Moto loadMotoId(SessionFactory SessionBuilder, int idMoto) { Session conexion = SessionBuilder.openSession();...
asked by 01.02.2018 / 17:16
1
answer

JsonObject Android

I am making a listview through a json that I bring from a server. The detail is that I can not pass my data to listview in this function I try to save them from there to move them to listview public ArrayList<String>...
asked by 11.08.2017 / 08:54