Skip to content

Instantly share code, notes, and snippets.

@teffcode
Created May 11, 2021 03:44
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save teffcode/29ab8bdc641a70482af7ed919187be70 to your computer and use it in GitHub Desktop.
Save teffcode/29ab8bdc641a70482af7ed919187be70 to your computer and use it in GitHub Desktop.

👋🏼 Welcome 👋🏼

Quiz banner

Instagram | Twitter | LinkedIn


Choose your language 👅



English version 🚀


What is the output of the following code: A, B or C?


Click here to see the correct answer and explanation 👀
Correct Answer Explanation
C Since the spread operator "spreads" an array into different arguments, any functions that accepts multiple any number of arguments can benefit from use of the spread operator.

Explanation based on 👉🏼 How to Use the Spread Operator (…) in JavaScript | Medium


Code:

const mothers = ['👩🏻', '👩🏻', '👩🏻', '👽']
const happyMonth = (m1, m2, m3) => { 
  console.log(`${m1}${m2}${m3}`) 
}

happyMonth(...mothers)


Spanish version 🚀


¿Qué imprime el siguiente código: A, B o C?


Haz click aquí para ver la respuesta correcta y su explicación 👀
Respuesta correcta Explicación
C Dado que el Spread Operator "extiende" una matriz en diferentes argumentos, cualquier función que acepte varios argumentos puede beneficiarse del uso de este Spread Operator.

Explicación basada en 👉🏼 How to Use the Spread Operator (…) in JavaScript | Medium


Código:

const mothers = ['👩🏻', '👩🏻', '👩🏻', '👽']
const happyMonth = (m1, m2, m3) => { 
  console.log(`${m1}${m2}${m3}`) 
}

happyMonth(...mothers)


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment