DEV Community

Function Introduction

Thomas Cook on June 21, 2022

*Function function, what’s your function? * Simply put, a function is a piece of code that can be reused as many times as you like instead of dupl...
Collapse
 
jonrandy profile image
Jon Randy 🎖️

Functions that are assigned to variables are not anonymous. The very act of assigning them to a variable will give them a name if they do not already have one:

console.log( (function() {}).name )   // ''
const a = function() {}
console.log( a.name )   // 'a'
Enter fullscreen mode Exit fullscreen mode