### One abstract
Today, we will introduce an animation based on the queue in the data structure , Before the animation is implemented , Let's talk about it , stay JavaScript How do we implement a queue .
### Two queue

A queue is a list , The difference is that queues can only insert elements at the end , Delete element at team head . Queues are used to store data in order . fifo . This is not the same as a stack , In the stack , The last element put on the stack will be processed first . Think of queues as people in a bank queuing up to do business , The first person in line deals with business first , The rest of us have to line up , Until it's their turn .

Queue is a kind of first in first out (FIFO) Data structure of . Queues are used in many places . For example, submit the operating system to execute a series of processes . Task pool printing . Some simulation systems are used to simulate customers queuing in a bank or grocery store .

Queues are used frequently in programming , because javascript Single thread , Therefore, only one task can be executed in any period of time , It also involves asynchronous mechanism .

stay JavaScript In the use of , Queues are usually used to sort tasks . The tasks in the task queue are delayed in the order they are entered into the queue ( Resolve state consistency ) Of , After the completion of the current task , Later tasks are executed , If there are no tasks currently , The queued task is executed immediately

### Three Resulting problems

* When an asynchronous operation is executed , The synchronization code continues , So synchronous code depends on asynchrony , It's natural to make mistakes
* Multiple synchronized tasks are called at different times
### Four Specific implementation
#### The first step Building a queue

#### Step two Implement class methods
#####1) Adding elements to a queue

#####2) Delete element to queue

#####3) Read the first element of the queue

#####4) Read end of queue element

#####5) Displays all elements in the queue

#####6) Determine whether the queue is empty

#### Step three Effect display

#####) The first step : New object

#####) The first step : Operation results

### Five conclusion
That's all for today , I'll continue to talk about queue based animation tomorrow , In fact, if you know about the data structure before , Queue operations should be familiar , Queue is still used more in actual development !

Technology
©2019-2020 Toolsou All rights reserved,
java Four functional interfaces ( a key , simple )os Simple use of module Browser kernel ( understand ) Some East 14 Pay change 16 salary , Sincerity or routine ?HashMap Explain in detail It's unexpected Python Cherry tree (turtle The gorgeous style of Library )html Writing about cherry trees , Writing about cherry trees