Talk:Netscript Data Types and Variables/@comment-46.59.41.3-20180110211106/@comment-32335387-20180110215349

You can implement a queue simply using an array (which are the same as Javascript arrays). I'm not sure exactly what you're trying to do with your queue but I don't think you should be using the 'indexOf' or 'substring' functions because those are for strings, not arrays.

To make a queue you can just use the push and shift functions of an array (see here). Here's a simple example:

queue = []; //Add an element to the queue queue.push(1); queue.push(2); queue.push(3); //Get an element from the queue foo = queue.shift;