Posts by anijahzarri • 39 points
3 posts
-
1
votes2
answers61
viewsQ: Execute method only if there is specific property in the object. No testing each line with hasOwnProperty() or comparing with Undefined
I am working with automated tests and in my case I have several objects that contain the settings that will be inserted in the system fields. There I have the methods Set filling the fields with the…
javascriptasked anijahzarri 39 -
-1
votes3
answers199
viewsA: Cut unnecessary zeros from a string, without toFixed()
I also added how to remove zeros before and after the comma of a number in string format: function stripZeros(str) { str = str.replace(/^0+(?=\d)/, '') //remove zeros da frente return…
javascriptanswered anijahzarri 39 -
2
votes3
answers199
viewsQ: Cut unnecessary zeros from a string, without toFixed()
How do I delete zero values from a string? Examples: "100,50" >> "100,5" "2,00" >> "2" Only in cases where there is zero at the end. For example, I do not want to round with that…
javascriptasked anijahzarri 39