Posts by Gleison Elias • 137 points
6 posts
-
1
votes2
answers110
viewsQ: How to prevent function modifies global variable?
Creating a function to return a given value, from received parameters, it modifies the variable it receives. For example: var a = ["oi", "tchau"]; function duplicar(c) { var b = c; b[0] = b[0] +…
-
1
votes1
answer340
viewsQ: How to detect if an element is under another element? (HTML, via javascript)
I would like to know how to detect, in a simple way and return the information I need, if one element is under the other. I’ve tried for the offset, but it was very difficult and did not result in…
-
2
votes3
answers881
viewsQ: Is it possible, in CSS or Javascript, to leave a color of a transparent image?
For example, we have this boat: <div> <img src="https://cdn2.vectorstock.com/i/thumb-large/94/56/lifeboat-vector-3669456.jpg" > </div> In this case, I want the white color…
-
1
votes2
answers193
viewsQ: How do I replace a specific part of a string?
I would like to know how to replace part of a string, but only part of order N. For example, replace the second (only) "and" of "electricity". Input: Electricity Output: Eltricidade Maybe it’s…
-
1
votes1
answer60
viewsQ: How to add a character in a string, which is already divided, to each N characters?
I need to know how to separate, in line breaks, a string each N characters. However, before separating each N characters, they have already been separated by each comma. I want that in the output…
-
4
votes2
answers1502
viewsQ: Is there a more optimized way to "multiply" a string without using repetition?
I’m creating an algorithm in Javascript, and I’m already finding it very heavy. Now I need a string "multiplied" N times. I wonder if it is possible to do this without using a repeat. For example,…