Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
how to convert number to persian number with js
// # 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()); // یک هزار و چهارصد
@senior-x-79

This comment has been minimized.

Copy link
Owner Author

@senior-x-79 senior-x-79 commented Aug 9, 2021

لینک این مقاله

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment