Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class List{
- constructor(){
- this.list = [];
- this.size = 0;
- }
- add(param){
- this.list.push(param);
- this.size = this.list.length;
- return this.list.sort((a,b)=>a-b);
- }
- remove(index){
- if(index >= 0 && index < this.list.length){
- this.list.splice(index,1);
- this.size = this.list.length;
- return this.list.sort((a,b)=>a-b);
- }
- }
- get(index){
- if(index >= 0 && index < this.list.length){
- return this.list[index];
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement