Skip to main content

diffCount

diffCount 计算两个数的差值

🍱 参数

  1. number - a
  2. number - b

🔥 返回值

number - 差值

🚀 示例

import { diffCount } from 'atools-js';

diffCount(1, 2); //1
diffCount(2, 1); //1

💡 源码

source code
/atools/_calc/diffCount.ts
export const diffCount = (a: number, b: number): number => a > b ? a - b : b - a