DEV Community

Cover image for Functions in Javascripts
anshuldaksh2016
anshuldaksh2016

Posted on

1

Functions in Javascripts

Functions are the heart of JavaScript and functions are the beautiful parts of JavaScript.

Well , Functions are the most important part of JavaScript and in this blog I am not going to cover functions in detail instead I will be explaining hell lot of Jargons which will be beneficial for the Interview .

  • Function statement : Function statement is nothing but how we write the functions in JavaScript. example :

function fun(){
// some code
}

  • Function Expressions : Well its a confusing one when we allocate a function to a variable then it is called as function expression. example : const a = function(){ //code } a();

here function acts like a value

  • Function Declaration : Function declaration is nothing but a simple function definition .
    example :

    function fun(){ // some code }

  • Anonymous function : Function without a name is called anonymous function .

example :
`
let fun = function(){ // some code }

fun() ;
`

  • Named function expression : These are same as function expression . example :

const a = function () {//some code }

  • Function Parameters: Function parameters are the identifiers that function take on its declaration . Take a look at example below .

example :

function app(param1 , param2 )

  • Function arguments : Function arguments the identifiers that are supplied, when we call function.

function app(param1 , param2 )
app(arg1, arg2)

  • First class functions : First class functions are those functions which can be passed as arguments to another function , function which can return another function and assign a function to a variable . So combination of all the above functions are said to be higher order functions .

If you like it please give it a thumbs up .

source - youtube and mdn docs

Heroku

This site is built on Heroku

Join the ranks of developers at Salesforce, Airbase, DEV, and more who deploy their mission critical applications on Heroku. Sign up today and launch your first app!

Get Started

Top comments (0)

Image of Timescale

Timescale – the developer's data platform for modern apps, built on PostgreSQL

Timescale Cloud is PostgreSQL optimized for speed, scale, and performance. Over 3 million IoT, AI, crypto, and dev tool apps are powered by Timescale. Try it free today! No credit card required.

Try free

👋 Kindness is contagious

Engage with a sea of insights in this enlightening article, highly esteemed within the encouraging DEV Community. Programmers of every skill level are invited to participate and enrich our shared knowledge.

A simple "thank you" can uplift someone's spirits. Express your appreciation in the comments section!

On DEV, sharing knowledge smooths our journey and strengthens our community bonds. Found this useful? A brief thank you to the author can mean a lot.

Okay