Skip to content

Instantly share code, notes, and snippets.

Avatar

senior-x-79

View GitHub Profile
@senior-x-79
senior-x-79 / number-to-persian-letters.js
Created Aug 9, 2021
how to convert number to persian number with js
View number-to-persian-letters.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()); // منفی سیزده هزار و نهصد و هشتاد
@senior-x-79
senior-x-79 / separate numbers in javascript.js
Last active Aug 9, 2021
how to separate numbers in javascript
View separate numbers in javascript.js
const inpNumber = document.getElementById("my-decimal-number");
inpNumber.addEventListener("keyup", handlerSeparateNumbers)
// functions
function funcReverseString(str) {
return str.split('').reverse().join('');
}
// event handlers
function handlerSeparateNumbers(e) {