So does having the baggage of these many languages worth it? Well, it depends who you ask but my answer is always, Yes. Actually, I am planning to learn Rust next, so enough is never enough for me. However, I don’t encourage this practice in certain contexts. …
In the “Introduction to Canvas” lesson, we learned about the Canvas Web API and how to draw basic shapes. In that lesson, we also saw how to animate those shapes on the canvas and how surreal it can be to achieve the simplest animations. The Canvas API is not at fault, this is how animations work.
In the previous lesson, we learned about the Canvas Web API and what it is used for. In a nutshell, the Canvas Web API gives us the capability to draw 2D/3D objects natively on the Web using the HTML5
canvas element and built-in rendering engines (also called drawing contexts).
However, we also discussed some of the problems with this native API, first and foremost, the lack of an object model. When we draw a shape on the canvas, we do not get a reference back to it. Therefore we don’t get the ability to manipulate individual shapes on the canvas. In the animation section of the above tutorial, we saw how this can create a problem. …
I wanted to keep the title of this article “Why every web developer must know Canvas API?” but then decided not to because to be honest, we don’t use Canvas API that regularly or in most of the cases, ever. But Canvas API, in my opinion, is least explored, however, it can do pretty amazing things. First, let’s understand what Canvas API is and what it can do for us.
Take a look at the above image. What do you see? You see a canvas on which you can draw (or paint) something. It has a background color, in this case white, and proper width and height. You can’t paint beyond these dimensions since there is nothing to paint on. …
It’s harder to digest the title of this article. How can we possibly create a binary executable
.exe file is generally called a binary executable file. Unlike a normal program file or simply any file with data of a particular format (such as a
.png file with image data), a
.exe file contains various different things such as actual program code, program data, static resources, dependencies among others. …
.js) with all the application code inside it. It was not only harder to maintain but a pain in the a** to look at and make sense of it. …
If you haven’t read the TypeScript Compilation lesson, then first go through it once. The knowledge of the TypeScript compilation process and the
tsconfig.json file is necessary to understand this lesson.
main.js which you will eventually import in the Web application using a
The Strict Equality operation is what we are used to. Instead of usual
== (double equals) operator, we use
=== (triple equals) operator to perform strict equality check. In this operation,
A === B, both
B should be of the same type else the result will be always
false since two values of different data types can’t be equal in any universe. …
falsyvalues that resemble
When you write
if/else statement in any programming language, you expect to pass a value in the
if() condition that is strictly
boolean which means either
false. It could also be an expression that evaluates to one of these values as demonstrated below.
falsy -> false, '', "", 0, -0, 0n, NaN, null, undefined
truthy -> anything that is not mentioned above
Therefore, if you use one of these values in
if/else statement, you are going to get the same treatment as native
false values as shown below. You can also use an expression that returns these values. …
You all must have used
new operator. We used
new operator to construct object from a constructor function or a class. A class under the hood is a constructor function with a prototype, so we can safely say that
new operator invokes a function and returns an object. Let’s see an example.
In the above example, we have created a
Person constructor function that accepts
lastName argument and initializes
lastName properties on the object with their values. It also has the
getFullName method on its prototype that returns the full name. …