; Run = function () { ; return Array.prototype.splice.call( arguments, -1 )[0].apply( this, arguments ) } ; Loop = function () { var count = -1 , end = arguments.length -1 , _func = arguments[ end ] ; while ( ++count < end ) { ; _func.apply( this, arguments[ count ] ) } } ; Run( 2, 3, 4, function( x, y, z ) { console.log( x*y*z ) }) ; Run.call( { name : ‘Run‘ }, 2, 3, 4, function( x, y, z ) { console.log( this, x*y*z ) }) ; Loop( [ 2, 3 ], [ 4, 5 ], function ( x, y ) { ; console.log( x*y ) }) ; Loop.call( { name : ‘Loop‘ }, [ 2, 3 ], [ 4, 5 ], function ( x, y ) { ; console.log( this, x*y ) })
时间: 2024-10-09 10:06:18