Posts by Luís HNrique • 307 points
9 posts
-
0
votes2
answers45
viewsA: How do I increase a CSS property using Js?
You can use the offsetLeft to take the value of left if not yet defined. offsetLeft returns the computed value of left, for example: Element x is in position left 200px. offsetLeft had returned 200.…
-
0
votes1
answer31
viewsA: Weird execution of "Drag and Drop"
It was a very simple mistake. The code works the first time because moveRoom starts as undefined. In the second execution moveRoom is no longer indefinite so the code does not apply. I simply…
-
-1
votes1
answer31
viewsQ: Weird execution of "Drag and Drop"
I’m trying to do several div have the "drag and drop" function. This code works in a way that you can add and remove divs dynamically (not yet integrated into the code). The code works fine, but…
-
3
votes2
answers70
viewsQ: How to make calculations with instances of a class, or even with new instances?
I want to do an operation with two, or more, instances of a class. Is there any way to do this? Example: class myClass{ constructor(a){ this.a = a } } var myObj1 = new myClass(2) var myObj2 = new…
javascriptasked Luís HNrique 307 -
1
votes1
answer22
viewsQ: Check if the value of an object of a certain class has been changed
I want when one value is changed within one object of a certain class, another to change as well. Example: class minhaClasse{ constructor(valor1, valor2){ this.valor1 = valor1 this.valor2 = valor2…
-
4
votes1
answer53
viewsQ: How to access the "this" of a class with an external function?
I want to create a function within a class that is defined externally, but I can’t access the this class. Example: class minhaClasse { constructor(objeto){ this.meuNumero = objeto.meuNumero…
-
3
votes1
answer51
viewsQ: Change the native console function.log
There is some way to change the console’s native function.log, but keep the old one? Ex: console.log = (e) => { antigoConsoleLog(e); alert(e); //exemplo minhaFuncao(e); //exemplo }…
-
0
votes1
answer44
viewsQ: Set value within an object equal to the previous value
Is there any way to define the value of an object to be equal to the previous object? Example: var obj = {a: 1, b: obj.a}; I tried used b: this.a also but created an html Circle tag, I did not…
-
8
votes2
answers118
viewsQ: What’s the difference between executing code inside or outside the "for" keys?
In Javascript or C, there is some difference between using for in the normal way: for(var i = 0; i < 10; i++){ console.log(i); } or execute the codes within the parentheses? Example: for(var i =…