File tree Expand file tree Collapse file tree
02-languages/02-apuntes/01-javascript Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -14,10 +14,11 @@ function saySomething() {
1414
1515console . log ( typeof saySomething ) ; // "function" Aunque en el fondo, es también un objeto.
1616
17- // Añadiendo argumentos
17+ // Declarando parámetros a la función
1818function saySomething ( arg1 , arg2 ) {
1919 console . log ( arg1 , arg2 ) ;
2020}
21+ // La invocamos pasandole argumentos a los parámetros declarados
2122saySomething ( "hello" , "world" ) ; // hello world
2223saySomething ( "hello" ) ; // hello undefined
2324saySomething ( ) ; // undefined undefined
@@ -36,7 +37,8 @@ console.log(saySomething("hello")); // hello undefined, false
3637
3738// VARIADIC FUNCTIONS
3839
39- // Argumentos dinámicos o variables (variadic functions) mediante el objeto iterable arguments
40+ // No declaramos parámetros estáticos sino que tomará argumentos dinámicos o variables
41+ // (variadic functions) mediante el objeto iterable arguments
4042function logArguments ( ) {
4143 console . log ( arguments ) ; // "arguments" es un objeto array-like (iterable)
4244}
You can’t perform that action at this time.
0 commit comments