Open in app
Johannes Baum
555 Followers
About

Sign in

555 Followers
About
Open in app
Johannes Baum

Johannes Baum

·Nov 17, 2020

Hey Jay,

a simple example would be:

const queue = Queue();

queue.enqueue('test');

queue.enqueue('test2');

console.log(queue.dequeue()); // test

console.log(queue.peek()); // test2

console.log(queue.dequeue()); // test2

console.log(queue.dequeue()); // null

I hope this helps.

In your last example (Queue Factory Function) could you give a brief example of how it is…
1

Jay Rumsey

More from Johannes Baum

Software Engineer 🚀 JavaScript 👾 TypeScript

More From Medium

How To Access “this” Inside a JavaScript Callback Function

Johannes Baum in Better Programming

How To Return a Response From Asynchronous Calls in JavaScript

Johannes Baum in Better Programming

Grid-Based Movement in a Top-Down 2D RPG With Phaser 3

Johannes Baum in The Startup

JavaScript Async/Await Pitfalls With ForEach

Johannes Baum in Better Programming

3 Reasons Why You Shouldn’t Use “for…in” Array Iterations in JavaScript

Johannes Baum in Better Programming

Why You Should Use ES6 Sets in JavaScript

Johannes Baum in Better Programming

How To Check if a Property Exists on a JavaScript Object

Johannes Baum in Better Programming

Getting Query String Values in JavaScript in 2021

Johannes Baum in Better Programming

About

Help

Legal

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store