Javascript
Don't use arguments object in Arrow functions
· ☕ 1 min read
Arguments object throws an error when used with arrow functions. Consider this code - 1 2 3 4 5 6 function getSum() { return arguments[0] + arguments[1]; } console.log(getSum(1, 2)); // 3 The result is as expected. But, you cannot do the same using an arrow function.

Modern Desktop UI Using Javascript and Qt
· ☕ 2 min read
One of the interesting projects that I came across recently was NodeGUI. NodeGUI describes itself as an enabler to build cross-platform desktop applications using Javascript (and React) and Qt5. Using NodeGUI, you should be able to - Create desktop applications that run on Windows, Linux or MacOS Styling with CSS Support for desktop events that are listenable from Qt Lower CPU/memory footprint Of course, the comparison with Electron is evident.

String Concatenation and Plus Operator
· ☕ 1 min read
Concatenating strings is a fairly simple affair. 1 2 console.log("hello" + " world"); // hello world This works because Javascript figures out the types, thinks that adding strings is not an intelligent thing to do, and therefore, concatenates the two strings. However, it may lead to problems.

Create a simple to do app using Svelte and GraphQL
· ☕ 6 min read
Let’s create a simple ‘to do’ application using Svelte and GraphQL. The objective is to demonstrate getting started on a GraphQL query and insert operation in a Svelte component. If you are new to Svelte, you may want to go over what Svelte can do from the official site, or see Svelte quick overview.

Get Started on Svelte
· ☕ 6 min read
The typical Javascript frameworks love playing the middleman. They continue playing that role at development and at run time. Svelte is not your typical middleman - instead the framework lays out the path during build, and completely hands over to standard Javascript at runtime. If that does not pick your interest - I don’t know what will 😜.

Null check gotchas
· ☕ 1 min read
Beware of these null check gotchas. Consider this code - 1 2 3 4 5 6 7 const sum = null; if (sum) { console.log("valid sum"); } // nothing printed The above code shows expected behaviour. Nothing is printed since if(sum) returns false. Now, try the code below.

Assigning default values while object destructuring
· ☕ 1 min read
Easily assign default values while destructuring objects. Consider below code- 1 2 3 4 const obj = { x: 9, y: 1 }; const { x, y } = obj; console.log(x, y); // 9 1 A typical destructuring of objects, this code assigns x and y variables to the x/y props of object obj.

Signify end of function with a return
· ☕ 2 min read
return terminates function whenever and wherever it is called. Consider this code block - 1 2 3 4 5 6 7 8 9 10 function getSum(x, y) { return x + y; let product = x * y; console.log(`sum is: ${x + y}, while product is ${product}`); } console.log(getSum(1, 5)); // 6 // no other console statements return will return the control to caller - no matter what state the function is in.

Three Invaluable shortcuts for type conversion in Javascript
· ☕ 1 min read
As Javascript developers we dream in type. Here are three quick and easy ways to convert from one type to the other in your Javascript code. Well, just kidding about the whole dream part. Most of us don’t quite care about types as much as we should. Anyhow, here are three quick ways to convert types -

Memoized Factorial Function in Javascript
· ☕ 1 min read
Get factorial of a given number using memoization techniques. Previously we have seen how memoization can be used in a reusable function to get all the advantages of memoization, without the complexity. Today, let us see one more practical example - get factorial of a given number. First, create a function to calculate factorial.

With statement in Javascript
· ☕ 2 min read
Avoid having to type your object notation multiple times using with statement. Consider the below code - 1 2 3 4 5 6 7 8 9 10 11 const earth = { name: "earth", satellite: "moon", position: 3 }; console.log("name:", earth["name"]); console.log("satellite:", earth["satellite"]); console.log("position:", earth["position"]); /* output name: earth satellite: moon position: 3 */ Typing “earth” everywhere can be quite laborious.

Prototype and property naming conflicts - shadowing issues in Javascript
· ☕ 2 min read
Be wary of prototype naming that can cause potential conflicts with one of the named objects. I have talked about using a non-emumerable property when defining a prototype, but what will happen if your prototype name conflicts with a prop name? You will loose quite a bit of hair - that’s what happens.

Git in VSCode
· ☕ 2 min read
I have been a great admirer and user of command line tools. They reduce so much time and energy while getting things done. But, on the other hand I have not been a reasonably good user of Git by itself. I could never come to terms with typing in one too many statements to get to where I was going.