{"id":87,"date":"2008-11-08T00:04:50","date_gmt":"2008-11-08T07:04:50","guid":{"rendered":"https:\/\/actionsnippet.com\/?p=88"},"modified":"2008-11-08T00:04:50","modified_gmt":"2008-11-08T07:04:50","slug":"numbertofixed","status":"publish","type":"post","link":"https:\/\/actionsnippet.com\/?p=87","title":{"rendered":"Number.toFixed()"},"content":{"rendered":"<pre class=\"brush: as3; title: ; notranslate\" title=\"\">\r\nvar someValue:Number = 2.0480531167374427;\r\n\r\n\/\/ want to show only 3 decimal places?\r\ntrace(someValue.toFixed(3)); \/\/ outputs 2.048\r\n<\/pre>\n<p>An easy way to get rid of extra decimal values. This is useful when you want to show decimal values in text fields. I only recently noticed this in the docs, I used to do this type of thing:<\/p>\n<pre class=\"brush: as3; title: ; notranslate\" title=\"\">\r\ntrace(int(someValue * 1000) \/ 1000);  \/\/ outputs 2.048\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>var someValue:Number = 2.0480531167374427; \/\/ want to show only 3 decimal places? trace(someValue.toFixed(3)); \/\/ outputs 2.048 An easy way to get rid of extra decimal values. This is useful when you want to show decimal values in text fields. I only recently noticed this in the docs, I used to do this type of thing: [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[41],"tags":[42,43],"class_list":["post-87","post","type-post","status-publish","format-standard","hentry","category-number","tag-decimal-places","tag-decimals"],"_links":{"self":[{"href":"https:\/\/actionsnippet.com\/index.php?rest_route=\/wp\/v2\/posts\/87","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/actionsnippet.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/actionsnippet.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/actionsnippet.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/actionsnippet.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=87"}],"version-history":[{"count":0,"href":"https:\/\/actionsnippet.com\/index.php?rest_route=\/wp\/v2\/posts\/87\/revisions"}],"wp:attachment":[{"href":"https:\/\/actionsnippet.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=87"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/actionsnippet.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=87"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/actionsnippet.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=87"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}