Created
August 9, 2021 11:14
-
-
Save senior-x-79/938f05c4921674fbe8454e589a3a705e to your computer and use it in GitHub Desktop.
how to convert number to persian number with js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// # first add script num2persian from https://www.npmjs.com/package/num2persian | |
// using from global funtion | |
console.log(Num2persian(1398)); // یک هزار و سیصد و نود و هشت | |
// number prototype | |
console.log((1398).num2persian()); // یک هزار و سیصد و نود و هشت | |
console.log((1.398).num2persian()); // یک ممیز سیصد و نود و هشت هزارم | |
console.log((-13980).num2persian()); // منفی سیزده هزار و نهصد و هشتاد | |
// string prototype | |
console.log("1,399".num2persian()); // یک هزار و سیصد و نود و هشت | |
console.log("1400".num2persian()); // یک هزار و چهارصد |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
لینک این مقاله