常用代码片段

#######################javascript ##########################

#1、js 数组操作

按索引交换数组元素

function swapArray(arr, index1, index2) {
   arr[index1] = arr.splice(index2, 1, arr[index1])[0];
    return arr;
}

 。。。。。。。。。。。。。。持续添加。。。。。。。。。。。。。。。。。。。

######################### java #############################

。。。。。。。。。。。。。。持续添加。。。。。。。。。。。。。。。。。。。

######################### python #############################

。。。。。。。。。。。。。。持续添加。。。。。。。。。。。。。。。。。。。

原文地址:https://www.cnblogs.com/lwcoding/p/7721910.html