Collar button javascript

/**
 * Initialize your data structure here. Set the size of the queue to be k.
 * @param {number} k
 */
var MyCircularQueue = function(k) {
    
};

/**
 * Insert an element into the circular queue. Return true if the operation is successful. 
 * @param {number} value
 * @return {boolean}
 */
MyCircularQueue.prototype.enQueue = function(value) {
    
};

/**
 * Delete an element from the circular queue. Return true if the operation is successful.
 * @return {boolean}
 */
MyCircularQueue.prototype.deQueue = function() {
    
};

/**
 * Get the front item from the queue.
 * @return {number}
 */
MyCircularQueue.prototype.Front = function() {
    
};

/**
 * Get the last item from the queue.
 * @return {number}
 */
MyCircularQueue.prototype.Rear = function() {
    
};

/**
 * Checks whether the circular queue is empty or not.
 * @return {boolean}
 */
MyCircularQueue.prototype.isEmpty = function() {
    
};

/**
 * Checks whether the circular queue is full or not.
 * @return {boolean}
 */
MyCircularQueue.prototype.isFull = function() {
    
};

/** 
 * Your MyCircularQueue object will be instantiated and called as such:
 * var obj = Object.create(MyCircularQueue).createNew(k)
 * var param_1 = obj.enQueue(value)
 * var param_2 = obj.deQueue()
 * var param_3 = obj.Front()
 * var param_4 = obj.Rear()
 * var param_5 = obj.isEmpty()
 * var param_6 = obj.isFull()
 */

this is the shelf above the collar button that uses javascript to implement circular queues. I want to ask
var obj = Object.create (MyCircularQueue). Create New (k)
what is the meaning of createNew (k).

Mar.02,2022

< del > is to implement a createNew method on the prototype of MyCircularQueue , and return an instance of MyCircularQueue . < / del >
should directly implement createNew on MyCircularQueue , that is, a static method of MyCircularQueue class, returning an instance of MyCircularQueue .

var obj = Object.create(MyCircularQueue).createNew(k)
//  __proto__ MyCircularQueueFunction
var tempObj = Object.create(MyCircularQueue);

// 
// tempOjb createNew__proto__MyCircularQueue
//  MyCircularQueue.createNew = function(){}; 
MyCircularQueue.createNew = function(obj){
    return new MyCircularQueue(obj);
}
tempObj.createNew(k);
Menu