When using function.apply(this, arguments) order of arguments gets mixed
<p>So I was trying to 'inherit' parameters in someway and I came across the use of </p>

<p><code>function.apply(this, arguments)</code></p>

<p>And it did the job... well for the most part. What I am getting is that when I'm calling a function from the parent object the arguments of the parent function get in front of the others and when I call a function from the inheritor they don't.</p>

<p>Here's my code:</p>

<pre><code>function Human(name, gender, tel, address){
    this.name = name;
    this.gender = gender;
    this.address = address;
    this.tel = tel;
}

Human.prototype.introduce = function(){
    console.log("Hi I'm " + this.name + " a " + this.gender + " from " + this.address + 
    ". My number is " + this.tel);
}

    Student.prototype = new Human; 
    Student.prototype.constructor = Student;


function Student(school,marks){
    Human.apply(this, arguments);
    this.school = school;
    this.marks = marks;

}

Student.prototype.average = function(){
    this.total = 0;
    this.average = 0;
    this.markslength = this.marks.length;
    for(var i = 0; i&lt;this.markslength; i++){
        this.total = this.total + this.marks[i]
    }
    this.average = (this.total)/(this.markslength);

    var marks3 = [6,6,2]
    var Nasko = new Student('Nasko', 'Male', 14421687, 'Sofia', 'FELS', marks3);
</code></pre>

<p>And when I do: <code>console.log(Nasko.name);</code> It's OK.
But when I do <code>console.log(Nasko.average());</code> It gives me NaN.
So my question is - how to actually 'fix' it</p>

<p>Sorry if I asked an already asked question but I couldn't really think of how to ask it in any short a redirection to another similar post will be welcome. Thanks in advance.  </p>
