Answers for "how do you create a function js?"

5

how to make a function

function myFunction(){
	console.log('hi')
}
myFunction()
Posted by: Guest on March-09-2020
1

how do you create a function js?

//(don't type behind the// type function to after that name it//
function name() {
  (name)=name
  console.log(name)
};
//{ symbol is used o group together code but you must create n index/array of 2(array3)//
Posted by: Guest on January-02-2021
2

js function

function myfunction() {
  console.log("function");
};

myfunction() //Should say "function" in the console.

function calculate(x, y, op) {
  var answer;
  if ( op = "add" ) {
    answer = x + y;
  };
  else if ( op = "sub" ) {
    answer = x - y;
  };
  else if ( op = "multi" ) {
    answer = x * y;
  };
  else if ( op = "divide" ) {
    answer = x / y;
  };
  else {
    answer = "Error";
  };
  return answer;
};

console.log(calculate(15, 3, "divide")); //Should say 5 in console.
//I hope I helped!
Posted by: Guest on June-22-2020
2

how to make javascript function consise

multiplyfunc = (a, b) => { return a * b; }
Posted by: Guest on April-04-2020

Code answers related to "how do you create a function js?"

Code answers related to "Javascript"

Browse Popular Code Answers by Language