Last active
July 7, 2020 17:33
-
-
Save agustinpfs/32f16d6c368a608d82b7fe746dea1c51 to your computer and use it in GitHub Desktop.
Javascript básico. Ejemplo función 1.
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 myFuncion() { | |
return 3 + 4; //sentencia. “return” me devuelve el valor calculado | |
} | |
//invocación: | |
myFuncion(); // 7 | |
//Utilizando parámetros: | |
function myFuncion(a, b) { | |
return a + b; | |
} | |
//invocación: | |
myFuncion(3, 4); // 7 | |
// Podemos crear una función en la que no necesitamos que retorne un valor, sino, que ejecute un comportamiento: | |
function myFuncion() { | |
alert("Hola Mundo"); | |
} | |
myFuncion(); //crea un alerta en el navegador |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment