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.
文字列の例から数値をキャッチまたはフィルタリングする必要があります。
var Mystring = "4.0" // or sometimes 4.5
この例では、.5orを見つけ.0て置換または削除する必要があります。
.5
.0
数字を切り捨てたいですか?
Math.floor(Number("4.0"))
スペースがあっても機能します:
Math.floor(Number(" 4.5 "))