Challenge: Practicing `pop` & `shift`
Oppgave
Swipe to start coding
- Use the
pop
method to remove the last element of the items array. - Use a
console.log
statement to print the array after usingpop
, in the format:After pop: [ element1, element2, ... ]
. - Use the
shift
method to remove the first element of the array. - Use a
console.log
statement to print the array after usingshift
, in the format:After shift: [ element1, element2, ... ]
.
Note
The
pop()
method should be used before using theshift()
method.
Løsning
Alt var klart?
Takk for tilbakemeldingene dine!
Seksjon 5. Kapittel 7