This language bar is your friend. Select your favorite languages!
Edit summary for version 27 :
New JS implementation by user [1.7.4]

Version 26

Version 27

Idiom #65 Format decimal number

From real value x in [0,1], create its percentage string representation s with one digit after decimal point. E.g. 0.15625 -> "15.6%"

Idiom #65 Format decimal number

From real value x in [0,1], create its percentage string representation s with one digit after decimal point. E.g. 0.15625 -> "15.6%"

Extra Keywords
percent
Extra Keywords
percent
Code
const s = Math.round (x * 1000) / 10 + '%'
Comments bubble
Sadly there's no builtin in JavaScript for this sort of thing.