
- Javascript Basics Tutorial
- Javascript - Home
- Javascript - Overview
- Javascript - Syntax
- Javascript - Enabling
- Javascript - Placement
- Javascript - Variables
- Javascript - Operators
- Javascript - If...Else
- Javascript - Switch Case
- Javascript - While Loop
- Javascript - For Loop
- Javascript - For...in
- Javascript - Loop Control
- Javascript - Functions
- Javascript - Events
- Javascript - Cookies
- Javascript - Page Redirect
- Javascript - Dialog Boxes
- Javascript - Void Keyword
- Javascript - Page Printing
- JavaScript Objects
- Javascript - Objects
- Javascript - Number
- Javascript - Boolean
- Javascript - Strings
- Javascript - Arrays
- Javascript - Date
- Javascript - Math
- Javascript - RegExp
- Javascript - HTML DOM
- JavaScript Advanced
- Javascript - Error Handling
- Javascript - Validations
- Javascript - Animation
- Javascript - Multimedia
- Javascript - Debugging
- Javascript - Image Map
- Javascript - Browsers
- JavaScript Useful Resources
- Javascript - Questions And Answers
- Javascript - Quick Guide
- Javascript - Functions
- Javascript - Resources
What is the difference between anonymous and inline functions in JavaScript?
Anonymous Functions
Anonymous, as the name suggests, allows creating a function without any names identifier. It can be used as an argument to other functions. This is how JavaScript anonymous functions can be used −
var myfunc = function() { alert(‘This is anonymous'); }
Another example can be the following −
setTimeout(function() { alert('Demo'); }, 3000);
Inline Functions
An inline function is a javascript function, which is assigned to a variable created at runtime. You can difference Inline Functions easily with Anonymous since an inline function is assigned to a variable and can be easily reused.
This is how JavaScript inline functions can be used −
var myfunc = function() { alert ('inline') }; $('a').click(myfunc);
- Related Articles
- What is the difference between functions and methods in JavaScript?
- What is the difference between closure and nested functions in JavaScript?
- What is difference between unescape() and escape() functions in JavaScript?
- What is the difference between custom and built-in functions in JavaScript?
- Anonymous Wrapper Functions in JavaScript
- What are Self-Invoking Anonymous Functions in JavaScript?
- What is the difference between default and rest parameters in JavaScript functions?
- What is the purpose of wrapping whole JavaScript files in anonymous functions?
- What is a typical use case for JavaScript anonymous functions?
- JavaScript closures vs. anonymous functions
- JavaScript Encapsulation using Anonymous Functions
- Difference between regular functions and arrow functions in JavaScript
- When to use anonymous JavaScript functions?
- What is the difference between CONCAT() and CONCAT_WS() functions?
- The Anonymous Functions in Python

Advertisements