Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

371
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar

0

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

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

0

To skip parameter 1, pass in undefined

veri=school(undefined, veri); 
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda