Javascript
Date Object in Javascript
· ☕ 2 min read
Let’s see a few points about when to use a date object, and why use this object vs. a date library? The simplest and quickest way to get date in Javascript - 1 console.log(Date.now()); // 1549025852124 Date.now() does not create an object, and is really fast. But, it is also useless if you want to do anything with the date.

Arguments Object in Javascript
· ☕ 2 min read
Arguments object enables you to treat function arguments with respect.. and the developers with compassion. How do you pass arguments to a function? In its most primitive form: 1 2 3 function getSum(a, b) { return a + b; } This is perfectly ok in an ideal world where Buddha walks the earth.

Non-enumerable Properties in Javascript
· ☕ 2 min read
When you define a prototype for an object you run the risk of counting that as an object property. Use non-enumerable to avoid doing that. Consider this - 1 2 3 4 5 6 7 8 9 Object.prototype.colors = () => { return; }; let fruits = ["apple", "orange"]; console.

Context of This in Javascript
· ☕ 3 min read
I have often seen how people talk and write about this being all complex and such. But frankly, I don’t understand the pain. All it takes for me to understand is 4-5 iterations of using this in a different functions, classes, modules and so forth, messing up a bit - each time, and trying to do that over & over until I get the right context with the right this.

5 Ways to Catch Common Javascript Bugs
· ☕ 4 min read
Javascript is a God-send if you are trying to get things done - quickly. It can run back-end servers, is invaluable for the front-end, and you will never thank enough when you on the way to complete a project that could have taken 10x the time/effort back in the day.

Change Function Scope in Javascript
· ☕ 2 min read
Javascript has lexical scope - the variable values are available and valid based on their position. The same is applicable to functions. At the same time declarations are brought to the top of their block at compile time. In other words, they are hoisted at the time of compilation, and hence variables and functions are available to statements accessing them before the actual declaration.

Const and Immutability in Javascript
· ☕ 2 min read
const is excellent. It allows us to keep our variables in controlled scope, and reduces errors caused by the case of mistaken reassignments. But it can also lead to a false sense of security. Not everything is truly immutable when defined by const. Consider this simple example - 1 2 const x = 1; x = 2; // TypeError: Assignment to constant variable.

Check if two arrays are equal in Javascript
· ☕ 1 min read
You can’t just equate arrays - you are smarter than that. Consider the simple example where we want to compare arrays and test their equality. 1 2 3 const fruits = ["apple", "orange"]; const oldFruits = ["apple", "orange"]; console.log(fruits == oldFruits); // false It may be obvious in hindsight - but array comparison in the above code will not compare values and give you the expected answer.

Make Navigation Responsive
· ☕ 3 min read
Navigation can be in form of links in static or drop-down menus in the main header or side-bar. We have to be careful and test navigation experience on all form factors and device types. I came to web development from the enterprise world. The data-driven applications that are built using off-the-shelf products are not quite cutting edge on adhering to the greatest of web standards.

Web-first Development
· ☕ 2 min read
I have started using Javascript everywhere and loving it. I am building everything targeted at the web world, with secondary experiences for mobile and desktop following the pattern used for web. Javascript, along with Vue, Vuetify and Quasar have changed the way I used to think about applications per se. With the ease of adding mobile (Cordova) and desktop (Electron) features to Vue apps, I have started solely focusing on web-first experience.

Javascript Frameworks - Expert Breakdown
· ☕ 2 min read
tldr; There are experts, and there are experts. Recently I came across evidence for time travel. I am referring to this blog post from 2016 - and outlining the same here in full glory. Popular NodeJS Frameworks Hapi, Meteor, Derby? Those were the days when Javascript was trying its super powers and finding itself on the good side - each and every time.

Use SVG Images Everywhere
· ☕ 3 min read
Use SVG images to minimize file/download size, maintain image sharpness, react to changes in screen size and devices. I have not been a fan of SVGs in the past. Editing them requires specialized knowledge (yes, Inkscape is specialised for me), editing them online has been flaky, and availability of SVGs for stock images have not been good.

Validate date in Javascript
· ☕ 2 min read
Date validation is not common for input fields since dates are ‘picked’ from a date picker rather than typed in. But it has its uses - for e.g. if you are enabling dates in a list view with copy/paste ability, or validating dates sent by a third party system. Let us look at a couple of ways in which you can validate dates.