Skip to content

Latest commit

 

History

History
18 lines (15 loc) · 282 Bytes

6.md

File metadata and controls

18 lines (15 loc) · 282 Bytes

删除数组指定下标值,返回新数组


 function deleIndex(arr, index) {
   let len = arr.length
   if (index > len || index < 0) {
     return false
   }
   for (let i = index; i < len -1; i++) {
     arr[i] = arr[i+1]
   }

   arr.length --
   return arr
 }