Skip to content

Instantly share code, notes, and snippets.

@teffcode
Created May 27, 2020 02:38
Show Gist options
  • Select an option

  • Save teffcode/5394cf305e8f84ba3dfda36164dfca53 to your computer and use it in GitHub Desktop.

Select an option

Save teffcode/5394cf305e8f84ba3dfda36164dfca53 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. ["馃崏", "馃崚", "馃崒"]
  C. ["馃崚", "馃崒", "馃崏"]

馃憖 Click here to see the correct answer and explanation
Correct Answer Explanation
B The push() method adds "馃崒" to the end of the array and the unshift() method adds "馃崏" to the beginning of the array. For this reason, the correct answer is ["馃崏", "馃崚", "馃崒"].

Explanation based on 馃憠馃徏 Array.prototype.push() & Array.prototype.unshift()



馃殌 Spanish version


驴 Qu茅 imprime el siguiente c贸digo ?

  A. ["馃崒", "馃崚", "馃崏"]
  B. ["馃崏", "馃崚", "馃崒"]
  C. ["馃崚", "馃崒", "馃崏"]

馃憖 Haz click aqu铆 para ver la respuesta correcta y su explicaci贸n
Respuesta correcta Explicaci贸n
B El m茅todo push() a帽ade "馃崒" al final del array y el m茅todo unshift() agrega "馃崏" al inicio del array. Por esta raz贸n, la respuesta correcta es ["馃崏", "馃崚", "馃崒"].

Explicaci贸n basada en 馃憠馃徏 Array.prototype.push() & Array.prototype.unshift()



@JoelNieto90
Copy link
Copy Markdown

let fruits = ["馃崚"]

fruits.push("馃崒"); // fruits = ["馃崚", "馃崒"]
fruits.unshift("馃崏") // fruits = ["馃崏", "馃崚", "馃崒"]

console.log(fruits); // fruits = ["馃崏", "馃崚", "馃崒"]

Respuesta: B. ["馃崏", "馃崚", "馃崒"]

Referencia: https://es.javascript.info/array

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