let salute = (age) => {
let showAge = (name) => {
console.log(`Welcome ${name}`)
console.log(`Your age is ${age}`)
}
return showAge
}
s = salute(16) // returns showAge function
s("chidi")
console.log(s) // returns the showAge function
(name) => {
console.log("Welcome " + name)
console.log("Your age is " + age)
}
Welcome chidi
Your age is 16
def salute(age):
def show_age(name):
print("Welcome ", name)
print("Your age is ", age)
return show_age
# Call the function
s = salute(16) # returns the show_age function
s("chidi") # pass the my name argument to the show_age function
Welcome chidi
Your age is 16