You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In JS Functions can represent data in your applications
constlog=message=>console.log(message)
Since Functions are variables we can add them to objects
constobj={message: "They can be added to objects like variables",
log
}
Functions can also be added to arrays
constmessages=["They can also be added to arrays",message=>console.log(message),"like variables",message=>console.log(message)]message[1](message[0])// they can be inserted into arrays message[3](message[2])// like variables
They can also be sent to functions as arguments
constinsideFn=logger=>logger("They can me sent to other functions as arguments")insideFn(message=>cnosole.log(message))// They can me sent to other functions as arguments
They can also be returned from other functions just like variables