lei-cycle
v1.0.0
Published
passed an array, cycle the array, returns an item every time
Downloads
12
Readme
node-lei-cycle
循环返回指定数组中的一个元素
var createCycle = require('lei-cycle');
var c = createCycle(['h', 'e', 'l', 'l', 'o']);
// 也可以这样: createCycle('h', 'e', 'l', 'l', 'o')
for (var i = 0; i < 10; i++) {
console.log(c());
}
输出结果:
h
e
l
l
o
h
e
l
l
o