Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

initialize function javascript

function function_name(){
	//function body
    console.log("my function")
}
//ES6 
const function_name = ()=>{
	//function body
    console.log("my ES6 function")
}

//you can call both functions like this
function_name()
Comment

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
})();
Comment

PREVIOUS NEXT
Code Example
Javascript :: fullcalendar v5 time format am/pm 
Javascript :: get first element by class name jquery 
Javascript :: Two different lockfiles found: package-lock.json and yarn.lock 
Javascript :: current date minus days javascript 
Javascript :: multiple line string javascript 
Javascript :: This version of CLI is only compatible with Angular versions 0.0.0 || ^9.0.0-beta || =9.0.0 <10.0.0, but Angular version 10.0.14 was found instead. 
Javascript :: slick slider multiple sliders on one page 
Javascript :: copy to clipboard using javascript 
Javascript :: javascript to get uri 
Javascript :: get first day of the week of a given date javascript js 
Javascript :: pagination hook react 
Javascript :: express return json 
Javascript :: how to set dropdown value in jquery 
Javascript :: a function that calls itself js 
Javascript :: javascript remove underscore and capitalize 
Javascript :: remove array elements javascript 
Javascript :: mongoose virtuals 
Javascript :: javascript strip 
Javascript :: window onscroll position fixed position in jquery 
Javascript :: simplebar react 
Javascript :: add css class to html in js 
Javascript :: js input type range get value on select 
Javascript :: remove brackets from array javascript 
Javascript :: how to validate the textbox using jquery 
Javascript :: datatables get all rows 
Javascript :: render tab screen when goBack function is called of other screen 
Javascript :: trigger hover event javascript 
Javascript :: useref array of refs 
Javascript :: decode morse code js 
Javascript :: how to use if in setstate 
ADD CONTENT
Topic
Content
Source link
Name
2+5 =