GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • JS Tutorial
  • Web Tutorial
  • A to Z Guide
  • Projects
  • OOP
  • DOM
  • Set
  • Map
  • Math
  • Number
  • Boolean
  • Exercise
  • Introduction3 min read
  • Variables5 min read

This view

  • Original page
  • New address

GeezerVison is showing www.geeksforgeeks.org — JavaScript Function Complete Reference - GeeksforGeeks

geeksforgeeks
search icon
  • Courses
  • Tutorials
  • Interview Prep
  • JS Tutorial
  • Web Tutorial
  • A to Z Guide
  • Projects
  • OOP
  • DOM
  • Set
  • Map
  • Math
  • Number
  • Boolean
  • Exercise

JavaScript Function Complete Reference

Last Updated : 5 Aug, 2025

A JavaScript function is a set of statements that takes inputs, performs specific computations, and produces outputs. Essentially, a function performs tasks or computations and then returns the result to the user.

Syntax:

function functionName(Parameter1, Parameter2, ..) {
// Function body
}

Example: Below is a sample program that illustrates the working of functions in JavaScript:

JavaScript
function greetUser(username) {
    console.log(`Hello ${username}, welcome to GeeksforGeeks`);
}
greetUser('Admin');

Output
Hello Admin, welcome to GeeksforGeeks

The Complete List of JavaScript Functions & Properties

JavaScript Function Parameters:

 Parameters

Description

Function The function definition and real values passed to the function in the function definition are known as arguments.
Rest Improved way to handle function parameters defined, allowing us to more easily handle various inputs as parameters in a function.
Default parametersIn JavaScript, the parameters of functions default to undefined. However, in some situations, it might be useful to set a different default value. 

JavaScript Functions  Properties:

Properties

Description

length Return the number of parameters required by a function.
displayNameSet the display name of the function.
caller Returns the function that invoked the specified function.
nameReturn the name of the function.

JavaScript Functions:

 Functions

Description

apply()It is different from the function call() because it takes arguments as an array.
isFinite()It returns true for all the values except +infinity, -infinity, or NaN.
isNaN()It returns true if the value is a NaN else returns false.
unescape()It decodes that string encoded by the escape() function.
escape()It can be transmitted to any computer in any network which supports ASCII characters.
number()Convert the data type to a number.
map()The calling function for each and every array element in an array.
String()Convert the value of an object to a string value.
eval()If the argument represents one or more JavaScript statements, eval() evaluates the statements.
uneval()Create a string representation of the source code of an Object.
parseInt()Accept the string and radix parameters and convert them into an integer.
parseFloat()Accept the string and convert it into a floating-point number.
console.log()To print any kind of variables defined before in it or to just print any message that needs to be displayed to the user.

Basics of Functions:

JavaScript Operations on Function

Description

Function GeneratorIt needs to generate a value, it does so with the yield keyword rather than return. 
Function BindingIn JavaScript, function binding happens using bind() method. 
Function InvocationIt is common to use the term “call a function” instead of “invoke a function”. 
Function ExpressionCreate an anonymous function that doesn’t have any function name. 
Arrow FunctionsProvide generator functions with a concise way to write functions in JavaScript. 
Async FunctionIt checks that we are not breaking the execution thread.
Pure FunctionsReturns the same result if the same arguments are passed.
Nested FunctionsReturn is a combination of the output from the outer as well as the inner function(nested function).

Understanding JavaScript functions is fundamental for effective programming. These functions and properties enable you to write cleaner, more efficient, and reusable code. For more advanced JavaScript tutorials and examples, explore our JavaScript Tutorial and JavaScript Examples.


Comment

Explore

    JavaScript Basics
    • Introduction3 min read
    • Variables5 min read
    • Operators4 min read
    • Control Statements4 min read
    Array & String
    • Arrays6 min read
    • Array Methods4 min read
    • String5 min read
    • String Methods8 min read
    Function & Object
    • Functions4 min read
    • Function Expression3 min read
    • Function Overloading4 min read
    • Objects4 min read
    • Constructors4 min read
    OOP
    • OOP5 min read
    • Classes & Objects4 min read
    • Access Modifiers5 min read
    • Constructor4 min read
    Asynchronous JavaScript
    • Asynchronous2 min read
    • Callbacks4 min read
    • Promises4 min read
    • Event Loop3 min read
    • Async Await Fuction3 min read
    Exception Handling
    • Error and Exceptional Handling5 min read
    • Errors Throw & Try to Catch2 min read
    • Custom Errors2 min read
    • TypeError Invalid Array.prototype.sort argument1 min read
    DOM
    • DOM8 min read
    • DOM Elements3 min read
    • Custom Events4 min read
    • Addeventlistener5 min read
    Advanced Topics
    • Closure3 min read
    • Hoisting5 min read
    • Scope4 min read
    • Higher Order Functions7 min read
    • Debugging3 min read
    Courses
    • Placement 360 Course2 min read
    • MERN Full Stack Course2 min read
    • DSA and System Design Course2 min read
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.