Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

122
Views
How these two lines of code performing exactly the same operation on the javascript object rect?

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.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

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

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!