手记

Array.prototype.push argument

https://www.zhihu.com/question/28467444
https://zhidao.baidu.com/question/1116157600709662699.html
https://www.jianshu.com/p/39ba41ead42e
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>

</body>
</html>
<script>
    var  arr = [1,2,3];
    Array.prototype.push=function(){
        for(var i=0;i<arguments.length;i++){
            //this[3]=arguments[0];
            //this[4]=arguments[1];
            //this[5]=arguments[2];
            this[this.length]=arguments[i];
        }
    }

    arr.push(8,9,10);
    console.log(arr);
</script>
0人推荐
随时随地看视频
慕课网APP