ammu
0
Q:

functions in javascript

function myFunction(var1, var2) {
  return var1 * var2;
}
3
How to create a function in javascriptJavascript By TechWhizKid on Apr 5 2020
function addfunc(a, b) {
  return a + b;
  // standard long function
}

addfunc = (a, b) => { return a + b; }
// cleaner faster way creating functions!
3
/* Declare function */
function myFunc(param) {
  // Statements 
}
2
function sayHelloTo(to) {
  alert(`Hello ${to}`);
}
sayHelloTo('World from Grepper')
0
function myFunction() {
  alert("ALERT!");
}

myFunction();
1

function myFunction(p1, p2) {
    return p1 * p2;  
//  The function returns the product of p1 and p2
}

or

var myFunction = function(p1, p2) {
	return p1 * p2;  
//  The function returns the product of p1 and p2
};


 
1

New to Communities?

Join the community