JavaScriptArray旋转()
n
n
-length < n < length
) :
Array.prototype.rotateRight = function( n ) { this.unshift( this.splice( n, this.length ) )}
var months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];months.rotate( new Date().getMonth() )
Array.prototype.rotateRight = function( n ) { this.unshift.apply( this, this.splice( n, this.length ) ) return this;}
慕码人2483693
相关分类