Questions tagged as 'object'

2
answers

Logic to group data in array javascript

I'm having trouble grouping some data using JavaScript . I have the following array of objects that return from the database and send it to view : var object = [ { data: 1, categories: "Branca", name: "Feminino" }, { data: 1, ca...
asked by 09.11.2018 / 00:59
1
answer

Type Object in PHP

I'm practicing some code in PHP when I come across this: <?php $a = (object) ["a" => "b"]; $b = (object) ["a" => "c"]; $y = $a <=> $b; echo $y; $v=[1,2,3] <=> [1,2,3]; echo $v; $a= (object) ["a" => "b"]; $b = (object)...
asked by 14.11.2018 / 22:26
2
answers

What is the property of __defineSetter__ and __defineGetter__ for?

Whenever I open the Chrome Console, I keep an eye on the autocomplete of properties, to see if there is anything new, something I have not yet learned. And it struck me to see that objects have the property called __defineSetter__ and...
asked by 18.05.2018 / 20:06
1
answer

Save all types of variables in a vector / array?

How can I store values and variables of all types within a vector? Ex: vetor1.Add("valor em string"); vetor1.Add(100); vetor1.Add(100.10); vetor1.Add(-100); I have no idea how I can do this.     
asked by 04.02.2018 / 13:46
3
answers

Anyone know me explain the following situation:

pessoa = { nome: 'leandro', idade: '2' } for(x=0;x<pessoa.idade;x++){ console.log('Ola mundo'); // ele repete 2 vezes "Ola mundo" na tela } The question I have is that I thought that javascript differed in string numbers, but...
asked by 20.07.2018 / 02:29
3
answers

Transform JSONArray into Class Object

I'm getting an API in my application that returns an Array of names, I've created a class to assign each name to 1 instance but I'm having trouble getting this JSONArray and turning it into object, all the methods I've tried do not Did they work...
asked by 18.10.2018 / 14:10
2
answers

Make user-written data stored in a JS object

I have this code and I wanted to know how best to get the user to push a button and, from there, store the data requested by the page in the JS object and, after that, display the message written in the code . Could someone help? Thank you. J...
asked by 23.05.2018 / 22:57
1
answer

Change attribute of an array of objects in the state in the application

To try to make an attribute of one of the objects in an array of objects switch between true and false follow code: Initial status: constructor(props) { super(props) this.state = { post: [{ nome: '',...
asked by 17.07.2018 / 15:55
1
answer

How to instantiate objects using literal object syntax?

I have a question maybe a little stupid, but come on, in Javascript, I can create an instance of an object stating thus, let's go in an example of a game, where I have to install bullets to shoot at the enemy: var Bala = { myFunctionInit:...
asked by 14.07.2018 / 02:08
1
answer

Composing objects in javascript

I'm studying a little more javascript here and I came to a problem: I have an object called player: let Player = function () { this.name = 'player'; } Player.prototype = new Sprite(); Player.prototype = new Shape2D(); That's what I...
asked by 20.07.2018 / 21:23