line1:
rect.setSize(height,widht)
line2:
setRectSize(rect,width,height)
The hypothetical functions invoked in these two lines of code may perform exactly the same operation on the (hypothetical) object rect.but the method invocation syntax in the first lines more clearly indicates the idea that it is the object rect that is the primary focus of the operation.
Assume rect is an instance of an object that has a method like
Rect.prototoype.setSize = function (h, w) {
this.height = h;
this.width = w;
}
rect.setSize(height, widht);
that's the same as doing
rect.height = height;
rect.width = widht;
Now the function
function setSize(rect, width, height) {
rect.height = height;
rect.width = width;
}
setSize(rect, width, height);
You can see it does the same thing