Last active
April 28, 2020 01:09
-
-
Save alexlecco/5b0f39a2aa2777ddd2eb7877fb696f72 to your computer and use it in GitHub Desktop.
aprendiendo que es un callback
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function saludar(cb) { // definimos la function saludar() | |
const mensaje = "hola soy dicky del solar!"; // definimos una constante | |
cb(mensaje); // invoco el callback | |
} | |
function callback(algo) { // defino el callback | |
console.log(algo); // consoleo el parametro que recibo en el callback | |
} | |
saludar(callback); // ejecuta la funcion saludar pasandole el callback |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function saludar(cb) { // definimos la function saludar() | |
const mensaje = "hola soy dicky del solar!"; // definimos una constante | |
cb(mensaje); // invoco el callback | |
} | |
saludar(function(algo) { | |
console.log(algo); | |
}); // ejecuta la funcion saludar pasandole el callback |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment