Posts by JDuwe • 191 points
5 posts
-
1
votes3
answers165
viewsA: return values of a javascript object
I would do it this way... It’s not so elegant, but it’s simple and efficient. const obj =…
-
0
votes2
answers72
viewsA: Calculations with numbers after the comma and toFixed
Are you wearing a parseInt(), it will convert the value to Integer. To convert the value to a Float use parseFloat(). But remember that the number should be typed with . (dot) as penny separator.…
-
3
votes2
answers130
viewsA: Transform String into Array of Elements
I think you need two things: First change the way you write the data, use the JSON form: {"id": "1", "x": 40, "y": 40, "radius": 5, "color": "rgb(255,0,0)"} attributes and string with double quotes…
-
0
votes3
answers149
viewsA: Set the value of a TD using a JS function
To insert text within an element other than an input, you must use the innerText attribute, as follows: document.getElementById("qtdUltimaCompra").innerText = "Texto"
-
2
votes1
answer65
viewsA: Searches in Objects without knowing the attribute name
What you need is a recursive Function, which searches the various levels of the object. More or less like this: function findStringInObj(obj, string) { for (let i in obj) { if (obj[i] instanceof…