D3
OG
Old school D3 from simpler times
All examples
By author
By category
About
kyleshevlin
Full window
Github gist
JS Bin // source http://jsbin.com/tuqihev
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width"> <title>JS Bin</title> </head> <body> <script id="jsbin-javascript"> function Queue () { this.storage = '' } Queue.prototype.enqueue = function (value) { if (this.storage.length === 0) { this.storage = value } else { this.storage = value + '***' + this.storage } } Queue.prototype.dequeue = function () { const items = this.storage.split('***') const value = items.pop() this.storage = items.join('***') return value } Queue.prototype.size = function () { return this.storage.split('***').length } const myQueue = new Queue() myQueue.enqueue('January') console.log(myQueue.storage) myQueue.enqueue('February') console.log(myQueue.storage) myQueue.enqueue('March') console.log(myQueue.storage) console.log(myQueue.dequeue()) console.log(myQueue.storage) console.log(myQueue.dequeue()) console.log(myQueue.storage) </script> <script id="jsbin-source-javascript" type="text/javascript">function Queue () { this.storage = '' } Queue.prototype.enqueue = function (value) { if (this.storage.length === 0) { this.storage = value } else { this.storage = value + '***' + this.storage } } Queue.prototype.dequeue = function () { const items = this.storage.split('***') const value = items.pop() this.storage = items.join('***') return value } Queue.prototype.size = function () { return this.storage.split('***').length } const myQueue = new Queue() myQueue.enqueue('January') console.log(myQueue.storage) myQueue.enqueue('February') console.log(myQueue.storage) myQueue.enqueue('March') console.log(myQueue.storage) console.log(myQueue.dequeue()) console.log(myQueue.storage) console.log(myQueue.dequeue()) console.log(myQueue.storage)</script></body> </html>