Posts by Aurium • 278 points
9 posts
-
1
votes1
answer26
viewsA: Make Shellscript act as pipLine
Just have your script use commands that read the default input and write to the default output. Example: We have the script abc-lines.sh: #!/bin/bash grep abc | wc -l We can use it in this command:…
-
1
votes2
answers378
viewsA: Json - Take key from a value
A simpler and more direct solution is possible: Getting your original data: data = { "pendente": 0, "cancelada": 1, "remitida": 2 }; This expression will return the string "remitida":…
-
0
votes2
answers787
viewsA: Regex that accepts only letters or letters and numbers
I would simplify your points "a", "b", "c" and "d", by: Letters and Numbers Numbers are optional It can’t be empty And this expression is the answer: ^[a-z0-9]*[a-z]+[a-z0-9]*$ You can test her…
-
0
votes1
answer113
views -
4
votes2
answers146
viewsA: What is Function.prototype.call() for?
You just need to use the call if you want to reset to which object a method is bound for that execution. The this js is dynamic. So you can transfer methods between objects and everything works. The…
-
1
votes1
answer57
viewsA: Deactivate the page scroll at a specific time
Try the following: document.querySelectorAll("#itens img").forEach(img => { img.addEventListener('mouseenter', ()=> document.body.style.overflow = 'hidden') img.addEventListener('mouseleave',…
-
2
votes1
answer100
viewsA: Create an Array with the numbers typed by the user
It seems to me that your only problem is this line: numeros.push(Number(num).value) You don’t have to Number(X).value, that .value is not a valid attribute, so returns undefined. But beyond that,…
-
0
votes2
answers137
viewsA: Select of dynamic cities , according to the selected state
I made a simple script to answer that question. If new questions arise (this is what I hope), do it in new posts as objectively as possible, as you did after editing. // Em vez de uma variável para…
javascriptanswered Aurium 278 -
2
votes4
answers261
viewsA: Generate 7 random dozens using javascript and loop for? How to do?
It would probably be better to write like this: (I’m assuming you want to generate dozens like in a lottery game) function gerarDezenas(numDezenas) { var dezenas = []; for (var i = 0; i <…