export class Stack < T > { private elements : Array < T > = [ ] ; get size ( ) : number { return this . elements . length ; } clear ( ) { this . elements = [ ] ; } push ( element ) { this . elements . push ( element ) ; } pop ( ) { if ( this . elements . length === 0 ) { return null ; } return this . elements . pop ( ) ; } }