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

297
Views
What do square brackets after function call mean?

I'm trying to understand the purpose of the [0] in the function call I came across and what value is returned to x?

x = my_function(var1, var2)[0];

function my_function(v1, v2){
  var v3, v4

  v3 = v1 * 3;
  v4 = v2 * 7;

  return( [v3, v4] );
}
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

They mean that the function returns an array and you only need the first element of that array.

return is not a function, by the way. You don't need the parenthesis.

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!