要求用javascript  实现Queue中按照java.util.Queue中描述的如下两个功能: 
Element()
Gets but not removes the element in the head of the queue. Throws a NoSuchElementException if there is no element in the queue
Returns
the element in the head of the queue.peek() 
Gets but not removes the element in the head of the queue, or throws exception if there is no element in the queue. 
Returns
the element in the head of the queue or null if there is no element in the queue.问题:  如何理解Queue中两个函数Element() & Peek()关于错误的处理?我的理解:
Element() 如果Queue没有head element, 一定要throw NoSuchElementException. 可以不返回任何值或者错误.  
Peek() 如果Queue中没有head element, trow 一个exception, 可以自己定义这个Error Message, 但是一定要返回Null. 请问高手, 是否有更加合适准确的理解?