yupaopao1653calc
Version:
这是一个集求和、差、积、商、最大值和最小值于一体的多功能计算器
36 lines (35 loc) • 732 B
JavaScript
// 这是一个计算器
// 求和、差、积、商
const getsum = (x,y) => x+y;
const getsub = (x,y) => x-y;
const getqua = (x,y) => x*y;
const getquo = (x,y) => parseInt(x/y);
//求最大值
const getmaxtwo =(x,y) => {
if(x>y) return x;
else return y;
}
const getmaxthree = (x,y,z) => {
if(getmaxtwo(x,y)>z) return getmaxtwo(x,y);
else return z;
}
// 求最小值
const getmintwo =(x,y) => {
if(x<y) return x;
else return y;
}
const getminthree = (x,y,z) => {
if(getmintwo(x,y)<z) return getmaxtwo(x,y);
else return z;
}
// 导出
module.export = {
getsum,
getsub,
getqua,
getquo,
getmaxtwo,
getmaxthree,
getmintwo,
getminthree
}