JavaScript Function Complete Reference Last Updated : 05 Aug, 2025 Comments Improve Suggest changes Like Article Like Report 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'); OutputHello Admin, welcome to GeeksforGeeks The Complete List of JavaScript Functions & PropertiesJavaScript Function Parameters: ParametersDescriptionFunction 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:PropertiesDescriptionlength 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: FunctionsDescriptionapply()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 FunctionDescriptionFunction 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 More infoAdvertise with us K kartik Follow Improve Article Tags : JavaScript Web Technologies javascript-functions JavaScript-Properties Explore JavaScript Tutorial 8 min read JavaScript BasicsIntroduction to JavaScript 4 min read JavaScript Versions 2 min read How to Add JavaScript in HTML Document? 3 min read JavaScript Syntax 6 min read JavaScript Output 4 min read JavaScript Comments 2 min read JS Variables & DatatypesVariables and Datatypes in JavaScript 6 min read Global and Local variables in JavaScript 4 min read JavaScript Let 6 min read JavaScript const 5 min read JavaScript Var Statement 7 min read JS OperatorsJavaScript Operators 5 min read Operator precedence in JavaScript 2 min read JavaScript Arithmetic Operators 5 min read JavaScript Assignment Operators 5 min read JavaScript Comparison Operators 5 min read JavaScript Logical Operators 5 min read JavaScript Bitwise Operators 5 min read JavaScript Ternary Operator 4 min read JavaScript Comma Operator 2 min read JavaScript Unary Operators 4 min read JavaScript in and instanceof operators 3 min read JavaScript String Operators 3 min read JS StatementsJavaScript Statements 4 min read JavaScript if-else 3 min read JavaScript switch Statement 4 min read JavaScript Break Statement 2 min read JavaScript Continue Statement 1 min read JavaScript Return Statement 4 min read JS LoopsJavaScript Loops 3 min read JavaScript For Loop 4 min read JavaScript While Loop 3 min read JavaScript For In Loop 3 min read JavaScript for...of Loop 3 min read JavaScript do...while Loop 4 min read JS Perfomance & DebuggingJavaScript | Performance 4 min read Debugging in JavaScript 4 min read JavaScript Errors Throw and Try to Catch 2 min read JS ObjectObjects in Javascript 4 min read Object Oriented Programming in JavaScript 3 min read JavaScript Objects 6 min read Creating objects in JavaScript 5 min read JavaScript JSON Objects 3 min read JavaScript Object Reference 4 min read JS FunctionFunctions in JavaScript 4 min read How to write a function in JavaScript ? 4 min read JavaScript Function Call 2 min read Different ways of writing functions in JavaScript 3 min read Difference between Methods and Functions in JavaScript 3 min read Explain the Different Function States in JavaScript 3 min read JavaScript Function Complete Reference 3 min read JS ArrayJavaScript Arrays 7 min read JavaScript Array Methods 7 min read Best-Known JavaScript Array Methods 6 min read Important Array Methods of JavaScript 7 min read JavaScript Array Reference 4 min read Like