MCPcopy Index your code
hub / github.com/TheAlgorithms/JavaScript / toArray

Method toArray

Data-Structures/Queue/Queue.js:93–103  ·  view source on GitHub ↗

* @description - Return the array of Queue * @returns {Array<*>}

()

Source from the content-addressed store, hash-verified

91 * @returns {Array<*>}
92 */
93 toArray() {
94 const array = []
95 let node = this.head
96
97 while (node) {
98 array.push(node.data)
99 node = node.next
100 }
101
102 return array
103 }
104
105 /**
106 * @description - Return is queue empty or not

Callers 1

Queue.test.jsFile · 0.45

Calls 1

pushMethod · 0.45

Tested by

no test coverage detected