Skip to content
Snippets Groups Projects
Commit 32f49a09 authored by Andrej Rasevic's avatar Andrej Rasevic
Browse files

adding Callback example

parent 4df98db5
No related branches found
No related tags found
No related merge requests found
function printName(name, cb) {
console.log("inside printName function")
console.log(name)
cb(name)
}
function printReverseName(name) {
console.log(name.split("").reverse().join(""))
}
function reverseString(str) {
return str.split("").reverse().join("")
}
printName("Nikola", printReverseName)
let sports = ["rowing", "cycling", "tennis", "padel", "soccer"]
let newSports = sports.map(sport => {
console.log("this is a multi-line arrow function")
return reverseString(sport)
})
console.log(sports)
console.log(newSports)
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment