KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have an array with numbers (coordinates) and I want to display those using JSON like so JSON.stringify(array); My array looks like: [{"x":-0.825,"y":0}, {"x":-1.5812500000000003,"y":-0.5625}, {"x":-2.2515625000000004,"y":-1.546875}] But I'm only interested in the first (lets say) 4 significant digits, i.e. [{"x":-0.825,"y":0}, {"x":-1.5813,"y":-0.5625}, {"x":-2.2516,"y":-1.5469}] Is there a way to easily ditch the remaining insignificant numbers?
Tags (comma-separated)
Save Edits
Cancel