Formatted text from an unformatted text file
formattedFile.txt
For the full content of this gist, refer to https://gist.github.com/CodingAbdullah/8abb1327cbb5024fb3cdd13c9b74b8a1
Hello, and welcome to this demo.
This is an unformatted string that we will be working with.
It's not a biggie, just a one-liner I am sure you have seen unformatted text files like these before.
The fact that you are still here reading this one-line file is extremely appreciative.
I never found someone so dedicated that takes the time to read through all this.
So why is this unformatted?
What are we going to do about it?
Well, as you can see we are going to make sure we can format this file you are reading so that you are comfortable reading through this file.
I hope you stick around for the string formatting process.
In short, we are making use of a Queue.
Ever heard of it?
A queue is a very simple data structure!
You can implement one using an array and follow what is called the FIFO principle.
Obviously, the world of JavaScript is very dynamic and working with arrays is very second-nature.
Nonetheless, I wish I had time to talk more, but I don't.
What you will be reading at end will be formatted, cheers!
undefined
Abdullah Muhammad@CodingAbdullah
McMaster. Software Engineer with a keen interest in blockchain and web3.