Learning JavaScript with p5.js
One of the most challenging aspects of learning programming is to find engaging examples that are not only fun and impressive but also illustrative of the subject matter at hand. Once you get the hang of it, programming is a highly rewarding and an engaging activity but to a beginner most of the problems that a professional programmer has to tackle, might seem uninteresting or straight up boring. That's why using the JavaScript library, an add-on, called p5.js is great in teaching and learning programming. p5.js will allow you to create engaging interactive and visual pieces that you would have fun while creating and it will also let you build a strong foundation for software development. The visual nature of this library will allow you to actually see the results from our scripts as graphics and develop an intimate understanding of programming structures.
p5.js is a programming library. A programming library can be thought as a collection of code that is built for a specific purpose so that whenever you need to perform an action that relates to that purpose you can use a library instead of building that functionality yourself. Libraries build on and extend the core capabilities of a language.
p5.js is a creative coding library that is based on the idea of sketching. Just like how sketching can be thought of as a minimal approach to drawing to quickly prototype an idea, p5.js is built on the concept of writing the minimal amount of code to translate your visual, interaction or animation ideas to the screen. p5.js is a JavaScript implementation of the popular library called Processing which is based on the Java programming language.
The concise nature of p5.js makes it a very easy library to learn. But don’t let this simplicity trick you into believing that p5.js has limited capabilities. p5.js has an impressive amount of functionality, history and community behind it to make it a valuable learning investment if you ever wanted to create art, design, motion or interactive pieces using code. A p5.js program can be anywhere from a few lines of code to thousands. Since p5.js was built with simplicity in mind, sometimes small p5.js programs are referred to as sketches. Even though that's a clever way to describe it, I am personally not a huge fan of that wording since it obfuscates the fact that what you are doing is programming after all.