Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

initialize function in javascript

// basically init function 
function functionName() {
    // some code
}

// ES6 init function
const function_name = () =>{
      // some code
}

// init function as method in object
const object = { 
  function_name : function() {
    // some code
  }
}

//  to use function
function_name();
object.function_name();

// immediately run function
((sum_var)=>{
  console.log(sum_var);
  //some code
})();


// immediately run async function
(async (sum_var)=>{
  await something();
  //some code
})();
 
PREVIOUS NEXT
Tagged: #initialize #function #javascript
ADD COMMENT
Topic
Name
9+7 =