UNPKG

calculator-partexercise-bp5

Version:

This is a exercise for learning npm init

43 lines (35 loc) 1.17 kB
const date = require('moment-jalaali'); date.loadPersian({usePersianDigits: true}); // dar inja function getMoment yek function private hast // chera? chon export nashode va ghabel estefade dar file haye digar nist. // eno neveshtam ta bedonid sar kelas ba deghat gosh dadam. :) function getMoment(){ return date().format('jYYYY/jMM/jDD'); } // function1: plus --------------------- function plus(a,b){ const c = a+ b; return `sum of ${a} + ${b} equal to ${c} | In ${getMoment()}` } // function2: minus ---------------- function minus(a,b){ const c = a - b; return `difference between ${a} - ${b} equal to ${c} | In ${getMoment()}` } // function3: division ------------------- function divison(a,b){ const c = a / b; return `division of ${a} / ${b} equal to ${c} | In ${getMoment()}` } // function4: multiply ------------------ function multiply(a,b){ const c = a / b; return `multiply of ${a} * ${b} equal to ${c} | In ${getMoment()}` } // exports modules: -------------------------- module.exports ={ plus: plus, minus: minus, divison: divison, multiply: multiply }