Creating a Stack Class question

Tell us what’s happening:
I passed the challenge but I just wanted some clarification on what is going on. The directions say that peek is supposed to return the first element so I returned collection[0], if you look at the posted solution they used collection[length-1].

I am having trouble understanding what end of the stack it is supposed to be. Can someone please explain?

Your code so far

function Stack() {
// var Top = -1;    //an index starting before
 var collection = [];
 this.print = function() {
 // Only change code below this line
this.push = function(val){
 return collection.push(val)
this.pop = function(){
 return collection.pop()
this.isEmpty = function(val){
if( collection.length == 0){
  return true


 else{return false}
this.clear = function(val){
 return collection.length = 0
this.peek = function(val){

 return collection[0]

 // Only change code above this line

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36.

Challenge: Create a Stack Class

Link to the challenge:

peek() returns top element, not the first. Imagine stack of papers or cards, top element is always the last

Thank you, that challenge is not worded well.