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
//? Closure is an important JavaScript pattern to give private access to a variable
function closures(val) {
return function (name) {
console.log(val + " " + name);
};
}
const greet = closures("Hello");
greet("Kirtti");
//* In a more real-world scenario, you could envision an initial function apiConnect(apiKey) that returns some methods that would use the API key. In this case, the apiKey would just need to be provided once and never again.