function Queue(){
this.dataStore = [];
this.inqueue = inqueue;
this.outqueue = outqueue;
this.front = front;
this.back = back;
this.toString = toString;
this.clear = clear;
this.empty = empty;
}
function inqueue ( element ) {
this.dataStore.push( element );
}
function outqueue () {
if( this.empty() ) return 'This queue is empty';
else this.dataStore.shift();
}
function empty(){
if( this.dataStore.length == 0 ) return true;
else return false;
}
function front(){
if( this.empty() ) return 'This queue is empty';
else return this.dataStore[0];
}
function back () {
if( this.empty() ) return 'This queue is empty';
else return this.dataStore[ this.dataStore.length - 1 ];
}
function toString(){
return this.dataStore.join('\n');
}
function clear(){
delete this.dataStore;
this.dataStor = [];
}
let queue = new Queue()
queue.inqueue('a')
queue.inqueue('b')
queue.inqueue('c')
queue.outqueue()
console.log(queue.toString())
console