Skip to content

Instantly share code, notes, and snippets.

@agustinpfs
Last active July 7, 2020 17:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save agustinpfs/32f16d6c368a608d82b7fe746dea1c51 to your computer and use it in GitHub Desktop.
Save agustinpfs/32f16d6c368a608d82b7fe746dea1c51 to your computer and use it in GitHub Desktop.
Javascript básico. Ejemplo función 1.
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