How to pass a flag/boolean as parameter to a function?

GD11
Tera Expert

I want to a pass boolean(with its value) or flat as a parameter/argument to below function. this function will be triggered from multiple sources, so I want to have value of the flag like below, any help would be appreciated.

 

myFunction: function(tasksysid, tasksource, flag/boolean){

if value is A then add the value in rest call parameter , or if value is B then do not add it in the rest call parameter

 

}

1 ACCEPTED SOLUTION

Basheer
Mega Sage

Hi @GD11 ,

You can directly declare the boolean from where you are triggering this funciton

For example

var flag = true;

var tasksysId = "something";

var tasksource = "nothing";

myFunction(tasksysId,tasksource,flag);

 

myFunction: function(tasksysid, tasksource, flag/boolean){

 

if(flag = true){

//Add true in rest call parameter

}

else{

//Add false in rest call parameter

}

}

 

Please hit like button if my suggestion has helped you in any way.
Please mark correct if my response has solved your query.

Cheers,
Mohammed Basheer Ahmed.

View solution in original post

1 REPLY 1

Basheer
Mega Sage

Hi @GD11 ,

You can directly declare the boolean from where you are triggering this funciton

For example

var flag = true;

var tasksysId = "something";

var tasksource = "nothing";

myFunction(tasksysId,tasksource,flag);

 

myFunction: function(tasksysid, tasksource, flag/boolean){

 

if(flag = true){

//Add true in rest call parameter

}

else{

//Add false in rest call parameter

}

}

 

Please hit like button if my suggestion has helped you in any way.
Please mark correct if my response has solved your query.

Cheers,
Mohammed Basheer Ahmed.