Posts by José Guilherme Oliveira • 81 points
7 posts
-
0
votes2
answers51
viewsA: Start script after a preset time
You can send the second as callback, so that one waits for the other I changed the structure to use await de Promisses instead of timeout, so I think it is easier to control. <h1>Aqui alguma…
-
0
votes1
answer151
viewsA: Javascript - Take for result and put each result inside an array
You can try like this success: function(res){ let dados = []; for(let i in res){ dados.push( [res[i].nome, res[i].sobrenome] ); } console.log(dados); } Bonus There are other easier forms to do this…
-
1
votes2
answers75
viewsA: How to modify an object array through a condition?
This way supports recursion: const childrens = {}; const parentNames = items.filter(item => item.parent).map(item => { if(!childrens[item.parent]) { childrens[item.parent] = []; }…
-
0
votes3
answers127
viewsA: Cloning elements with Javascript
I could not reproduce the problem, it is really lacking your HTML here to facilitate the answers, but try so to see if it solves: const otherClickListeners = () => {…
-
2
votes1
answer24
viewsA: Use variable value to compose function calling command
Quick response Ctrl types (hence switch options) could be attributes of an object: // no plural const ctrls = { local: localCtrl, banco: bancoCtrl, cartao: cartaoCtrl, saldo: saldoCtrl };…
javascriptanswered José Guilherme Oliveira 81 -
1
votes1
answer58
viewsA: Keep zeroes after the point
Quick response Write: {part: 'Renault', partNumber: 1234, project: 'X19', gap: 15000}, In place of: {part: 'Renault', partNumber: 1234, project: 'X19', gap: 15.000}, And when it comes to showing the…
-
0
votes3
answers214
viewsA: Change style of the last two characters of the string
Use a jQuery function An example of jQuery function to change the CSS style of the last X characters within a given HTML tag. // tagName é o nome da tag html que você quer mudar // classNames é uma…