Skip to content

Files

Latest commit

5cdafc9 · Jan 15, 2021

History

History

bigJs

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

简单的计算

依赖 bigJs

只做简单的封装

<script src='https://cdn.jsdelivr.net/npm/[email protected]/big.min.js'></script>
<script src="./algor.js"></script>
const $algor = new FedAlgor();
console.log('加法: ', $algor.plus(5, 4)) // 9
console.log('减法: ', $algor.minus('0.3', 0.1)) // 0.2
console.log('乘法: ', $algor.times(4, 2)) // 8
console.log('除法: ', $algor.div(1, 34, 7)) // 0.0294118
console.log('toFixed: ', $algor.toFixed(0.555, 2)) // 0.56

// 添加自定义方法
FedAlgor.prototype.mult = function(a, b) {
  return 'mult'
}

console.log($algor)