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

365
Views
How to only access seccond parameter?

I'm create a function and assigned two-parameter But For this assigned two-argument. I want to control one parameter right side [para2]

let veri=2;
function school(para1,para2)     // if para2 accept 
{
    para2=Math.floor(Math.random()*para2); //so :- 0 or 1
    return para2;
}
veri=school(veri);     // ! This veri pass arg second parameter
 if(veri){
   console.log('Time is playing cricket');
 }else{
   console.log('study time...');
 }

We have to pass two arguments for two parameters I want that only one argument should be passed and only the right side can be controlled.

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

0

One of the things you should pay attention to is the "syntax" of a programming language (Or frankly, any programming language).

When you are defining a function, or essentially a block of code with a specific scope, a name and parameters, you are basically saying how it should work and what it should do. Hence, defining a function with two parameters, you should consider the first parameter as well. Because you have defined it as such.

Now there are many ways to approaching this.

You can either give it a meaningless value:

school(undefined, veri)
// OR
school(0, veri)
// OR
school('Nothing to do here', veri)

Or inside the body of the function define distinct values that the function will not act upon.

But because there is a second parameter, you can't neglect it when you're calling your function.

about 4 years ago · Juan Pablo Isaza Report

0

In your case you can pass undefined as the first arg, e.g.

school(undefined, veri)
about 4 years ago · Juan Pablo Isaza Report

0

To skip parameter 1, pass in undefined

veri=school(undefined, veri); 
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!