Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
アプリケーションに「週」変数があります。
Math.abs(var_weeks / ONE_WEEK);
「37.3857142857143週」を返します
この値を「37.3 週間」に減らすにはどうすればよいですか?
コンマの後に数字を 1 つだけ残す必要があります。ありがとう!
コンマの後に1つの数字を残すために、次の数字を作成しました:
var weeks // it returns 5.123123 for example var weeksnum = weeks * 10; // it returns 51.23123 var weeksfinal = Math.round(weeksnum)/10; // it returns 512/10 - 51.2