What is the inline function in JavaScript ? Last Updated : 12 Jul, 2025 Comments Improve Suggest changes Like Article Like Report In JavaScript, an inline function is a special type of anonymous function that is assigned to a variable, or in other words, an anonymous function with a name. JavaScript does not support the traditional concept of inline functions like C or C++. Thus anonymous function and inline function is practically the same. Unlike normal functions, they are created at runtime. Syntax:Function:function func() { //Your Code Here}Anonymous function:function() { //Your Code Here}Inline functionlet func = function() { //Your Code Here };Explanation:Making an inline function is really simple. First, make an anonymous function(a function with no name), and then assign it to a variable. Example 1: In this example, we are showing different types of inline functions that are taking input as a parameter. JavaScript // Inline function in JavaScript let sum = function (x, y) { console.log(x + y); } // An annonymous function let product = (x, y) => { console.log(x * y) } // Normal function function maxElement(x, y) { if (x > y) console.log(`${x} ix the bigger`); else console.log(`${y} is the bigger`); } sum(10, 20); product(2, 4); maxElement(23, 45); Output30 8 45 is the bigger Example 2: In this example, we are showing different types of inline functions. JavaScript // Normal function function func() { console.log("Hello I'm inside function"); } //anonymous function let annonymous = function () { console.log("Hello I'm inside anonymous function"); } //inline function let inline_func = function () { console.log("Hello I'm inside inline function"); }; func(); annonymous(); inline_func(); OutputHello I'm inside function Hello I'm inside anonymous function Hello I'm inside inline function Comment More infoAdvertise with us Next Article Company Preparation S shubhamr238 Follow Improve Article Tags : Technical Scripter JavaScript Web Technologies Similar Reads Interview PreparationInterview Preparation For Software DevelopersMust Coding Questions - Company-wise Must Do Coding Questions - Topic-wiseCompany-wise Practice ProblemsCompany PreparationCompetitive ProgrammingSoftware Design-PatternsCompany-wise Interview ExperienceExperienced - Interview ExperiencesInternship - Interview ExperiencesPractice @GeeksforgeeksProblem of the DayTopic-wise PracticeDifficulty Level - SchoolDifficulty Level - BasicDifficulty Level - EasyDifficulty Level - MediumDifficulty Level - HardLeaderboard !!Explore More...Data StructuresArraysLinked ListStackQueueBinary TreeBinary Search TreeHeapHashingGraphAdvance Data StructuresMatrixStringAll Data StructuresAlgorithmsAnalysis of AlgorithmsSearching AlgorithmsSorting AlgorithmsPattern SearchingGeometric AlgorithmsMathematical AlgorithmsRandomized AlgorithmsGreedy AlgorithmsDynamic ProgrammingDivide & ConquerBacktrackingBranch & BoundAll AlgorithmsProgramming LanguagesCC++JavaPythonC#Go LangSQLPHPScalaPerlKotlinWeb TechnologiesHTMLCSSJavaScriptBootstrapTailwind CSSAngularJSReactJSjQueryNodeJSPHPWeb DesignWeb BrowserFile FormatsComputer Science SubjectsOperating SystemsDBMSComputer NetworkComputer Organization & ArchitectureTOCCompiler DesignDigital Elec. & Logic DesignSoftware EngineeringEngineering MathematicsData Science & MLComplete Data Science CourseData Science TutorialMachine Learning TutorialDeep Learning TutorialNLP TutorialMachine Learning ProjectsData Analysis TutorialTutorial LibraryPython TutorialDjango TutorialPandas TutorialKivy TutorialTkinter TutorialOpenCV TutorialSelenium TutorialGATE CSGATE CS NotesGate CornerPrevious Year GATE PapersLast Minute Notes (LMNs)Important Topic For GATE CSGATE CoursePrevious Year Paper: CS exams Like