learn
Input Field with Date Picker in Vuetify
· ☕ 3 min read
Date pickers are straight forward to implement, but input fields with date pickers need a bit of decoration. What we need? An input field with a date picker that opens on click shows the selected date How do we create that? We start with the ‘date picker’ component in Vuetify.

Check whether array is a palindrome in Javascript
· ☕ 1 min read
Check whether a given array has a palindrome in Javascript. Below logic should be fast, if not the fastest. 1 2 3 4 5 6 7 8 9 10 11 console.log(checkPalindrome([1, 3, 5, 3, 1])); function checkPalindrome(arr) { const len = arr.length; if (len % 2 == 0) return false; for (let i = 0; i < len / 2; i++) { if (arr[i] !

Find average and median of arrays in Javascript
· ☕ 2 min read
Find average and median of a given array in Javascript. Problem We are given an array that is hopefully comprised of numbers. Find average and median. Get average Calculate sum, length and use them to get the average. 1 2 3 4 5 6 const arr = [3, 7, 2, 6, 5, 4, 9]; const sum = arr.

Find difference between dates in days in Javascript
· ☕ 2 min read
Easy and right ways to calculate difference between two dates in Javascript. Problem We are given two dates and we have to print the difference between those two dates in days. Since we are given two valid dates, half of our problem is already gone and we have not started yet.

Filter before you sort arrays in Javascript
· ☕ 1 min read
Array sorting is easy, but can yield unexpected results if you are not careful. Consider this example - 1 2 3 const nums = [5, 2, 7, 9]; console.log(nums.sort()); // [ 2, 5, 7, 9 ] All beautiful and compliant so far. But, what if Loki lurks his head?

Use SVGs directly in Vue
· ☕ 3 min read
SVGs are optimized image files that bend to your will, er.. size. They stay sharp at various resolutions, are small in size, and can change colour through code! And, it is really easy to use them in Vue single file components. Consider this example of a tomato. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 <svg style="display:none;" version="1.

Accept Multiple Props in a Vue Component
· ☕ 1 min read
Vue enables you to define more than one prop against a component. See which component communication is effective and how props compare to Vuex Defining prop in a component is simple enough - 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 <!

Component Props in Vue
· ☕ 3 min read
Vue enables you to define more than one props against a component. Defining props and passing around values are one of the ways of getting components to react to values passed to them (think arguments), or talk to each other :). See which component communication is effective and how props compare to Vuex

Find where command is executed from in NPM
· ☕ 2 min read
It can get confusing if you have packages installed globally, and within project folder. Find out where the command originates from when you are using NPM. See below depending on what you are looking for. Info about a command that you put in the command line For e.g you do a -

A few useful commands in NPM
· ☕ 2 min read
npm is quite simple but immensely powerful for what we do as developers. At the heart of it, NPM just downloads stuff from its own registry on the Internet. But the underlying dependency management makes it an easy-to-use, super efficient tool. Here are some commands that I find useful in day-to-day work.

Package Managers in Javascript
· ☕ 6 min read
Since this blog existed and for many centuries before that, we had - “package managers”. These utilities have been quenching the thirst to build better applications and even better applications while standing on the shoulders of giants that grow ever bigger. Yes, they do all that despite their drab name.

Regular expressions in Javascript
· ☕ 4 min read
Regular expressions are patterns used to match and/or manipulate strings. This is a high-level overview of a few of the practical applications of a RegEx in Javascript. What is RegEx and what’s it doing in Javascript? A RegEx consists of simple and special characters that together form a language of its own.

Repeated function calls using an abstract pattern in Javascript
· ☕ 1 min read
Use this if you want to repeatedly call a function for known arguments, or in case you just need a IIFE. If you want a repeatedly called functions, you would typically - Call function in a loop Use recursion For e.g. - 1 2 3 4 5 6 7 8 9 10 11 function printStr(str) { console.