Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript function with condition in parameter

function myFuntionName(condition) {
	//this example uses an if statement
  	if (condition) {
    	//code 
    }
}

//call the function
let a = 8;
myFunctionName(a > 7);//a > 7 is converted into boolean before it is processed in the function
 
PREVIOUS NEXT
Tagged: #javascript #function #condition #parameter
ADD COMMENT
Topic
Name
3+9 =