摘要:
<script> function infinity(str) { var arr = str.split("") .sort() .join("") .replace(/((.)\2*)/g, "$1,") .split(",") .sort(function(a, b) { return b.l 阅读全文
摘要:
<script> function twoIndex(val, arr) { var start = 0, end = arr.length - 1, middle = Math.floor((start + end) / 2); while (arr[middle] !== val && end 阅读全文
摘要:
<script> /* 正则 */ function addComma(num) { return !isNaN(num) && num.replace(/(\d{1,3})(?=(\d{3})+(?:$|\.))/g, "$1,"); } console.log(addComma("1234567 阅读全文
摘要:
<!-- 正则 --> <body> <input type="text" id="pay"> <script> document.getElementById("pay").addEventListener("input", function() { this.value = this.value 阅读全文