I´ve got a function which should add an element at the start of an array.
But I always get an undefined element at the end of my array. I hope someone can help me :)
function putToFirst(e){
var array = [];
array.push(e);
this.arrayList = array.concat(this.arrayList);
}
EDIT:
class List {
constructor () {
super()
this.arrayList = [];
}
putToFirst(e) {
this.ArrayList.unshift(e);
}
}
thats the class. I create a new object from the class list and call the function putToFirst on this object. But I always get an Array with 'undefinded' in the end
No comments:
Post a Comment