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.

From the looks of the body of your function, you don’t seem to be using para1 at all. If you don’t use it and don’t want to complete it, then why not just remove it, and only require one parameter?

JavaScript matches arguments to parameters in the order they are sent. The above has no second argument so the value of para2 will be undefined. The return from that function will be ___? Give up? NaN.

Not quite sure what you are doing here.
If the goal is to have optional parameters you can do something like this:

let v = 2;
function school(p1, p2 = 2)
{
    p2 = Math.floor(Math.random() * p2);
    return p2;
}
v = school(v);

I’ve used your code, which oddly has no use for the para1,

Anyway by setting a parameter to defualt like school(p1, p2 = 2) you can chosse to only pass one agrugment, causing para2 to defualt to 2 in this case.
Or you can pass both arguments overriding the default for para2.

Unfortunatly like others have said, javaScript matches arguments to parameters in the order they are sent. So while you cant not ommit the first argument you could do somthing like this:

function school(p1, p2) { /* some code */ };
v = school(undifined, a2); // Or any value really, but undifined is the safest.

Alternatively you could make use of the rest parameter like so:

function school(...params) {
	// Basically, all the arguments are passed as an array, eg [p1, p2, p3, ...pN]
	// So we can pass how every many we want, here the function is expecting 1 or 2 args
	// If we get 2 args, use the second arg, if we only get 1 arg then use that
	let p2 = params.length < 2 ? params[0] : params[1];

	// some code
};

Hope I understood what you were looking for and this was helpful :sweat_smile:

according to what i want

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