[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
返回列表 发帖
本帖最后由 flashercs 于 2019-3-3 18:08 编辑
  1. /**
  2. * delete a member in an array for every nScale numbers loop;
  3. * @param aInput The input array with sequence members
  4. * @param nScale The granularity of the members removation
  5. * @param nRemained The remained members count in the array
  6. */
  7. function removeNO3(aInput = [1, 2, 3, 4, 5, 6], nScale = 3, nRemained = 1) {
  8.   var i = 0;
  9.   aOutput = aInput.slice(0);
  10.   --nScale;
  11.   while (aOutput.length > nRemained) {
  12.     i = (i + nScale) % aOutput.length;
  13.     aOutput.splice(i, 1);
  14.   }
  15.   return aOutput;
  16. }
复制代码
  1. removeNO3([1,2,3,4,5,6,7,8,9,10]);
  2. removeNO3([1,2,3,4,5,6,7,8,9,10],undefined,2);
  3. removeNO3([1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20],undefined,3);
复制代码
1

评分人数

微信:flashercs
QQ:49908356

TOP

返回列表