Files
bd-short-message-platform/app/middleware/utils/getArr.js

10 lines
267 B
JavaScript
Raw Normal View History

2026-03-27 17:51:58 +08:00
// 截取数组元素,组成新数组并返回
module.exports = (arr, start, end) => {
let newArr = [];
arr.forEach((element, index) => {
if (index >= start && index <= end) {
newArr.push(element);
}
});
return newArr;
};