Apply Vue Style Dynamically
· ☕ 2 min read
I have been using Vue and Vuetify quite a bit and absolutely loving it. The combination alongside some of the backend Javascript frameworks (like AdonisJS, Strapi) make web app building fast and fun. In this post let’s take a look at how we can dynamically style elements by using data to drive styling.

The Right WSL Setup for using Node
· ☕ 3 min read
A few node packages have been causing me pain lately. Who knew that my Windows 10 addiction can get me into trouble with node? There are, of course, multiple ways to solve the node problem on Windows. Do not use the offending package :). If there is no support for Windows, your great program does not get written using the specific package.

Spread Operators in Javascript
· ☕ 3 min read
A spread operator (...) provides a quick way to expand a Javascript object or array. Array or object is a collection of values. Accessing individual values within the array will require one to use a loop. 1 2 3 4 5 6 7 8 9 10 const fruits = ["orange", "apple"]; for (let i = 0; i < fruits.

Variable Scoping in Javascript
· ☕ 5 min read
Scope of a variable refers to the visibility of that variable. Since the visibility of a variable also determines whether it can be referenced in a valid way, scopes are said to define the ‘life time of a variable’. Scopes in Javascript can be global to the program, or local to the specific block and function.

Operator Precedence in Javascript
· ☕ 2 min read
Operator precedence includes unary, increment, basic arithmetic, logical and assignment operators - roughly in that order. The precedence can be remembered by BEUDMASLAS. brackets exponent unary & prefixed increment / decrement division multiplication addition subtraction logical assignment suffixed increment / decrement Not quite exciting as BODMAS or PEDMAS (math, anyone?

Javascript New Keyword
· ☕ 2 min read
New operator is used to initialize objects and create a new instance of the object. You would have seen new used in the object context in an earlier post. The usage is something like the below - 1 2 let worldExists = new Boolean(false); console.log(worldExists); // [Boolean: false] worldExists is an object that has a value of type ‘boolean’.

Rest Parameter in Javascript
· ☕ 1 min read
Rest parameter enables you to signify an ‘infinite’ parameter to a function. ... serves two purposes in Javascript - Spread operator - know what spread operators can do Rest parameter for a function Rest parameter just tells Javscript that there can be zero or infinite parameters for the function.

Object Assign Method in Javascript
· ☕ 1 min read
assign method of an object allows us to merge two objects quickly. 1 2 3 4 5 const name = { name: "earth" }; const position = { position: 3 }; const planets = Object.assign(name, position); console.log("planets: ", planets); // { name: 'earth', position: 3 } You can also use Object.

Property Descriptors in Javascript
· ☕ 2 min read
Property descriptors define property behaviour. They are attributes of the property. Everything is an object in Javascript. Yes, I know - except those pesky things called primitives on which objects are built. We saw some (quick discussions on objects and properties)[/objects-and-props-in-javascript/] before - but I wanted to outline the descriptors further.

Currying in Javascript
· ☕ 2 min read
Currying is a technique of splitting functions with one or more arguments into a sequence of functions that are invokable with predefined arguments. In other words, you can split fn (a,b,c) into fn(a)(b)(c). That was not quite helpful - let us see an example. 1 2 3 4 5 6 let getSquared = (x, y) => { return x * y; }; let getSquared = getProduct.

Comma operator in Javascript
· ☕ 2 min read
Did you know how to use comma operator in Javascript? A simple , can separate expressions in the same statement, evaluate left-to-right in the expression, pick the right most valid value as the result, and confuse other developers - all within the blink of an eye. We have discussed about operators when discussing operator precedence.

Javascript `typeof` issues and what to do about them
· ☕ 2 min read
typeof is useful but has inherent issues. There are gaps between what a developer expects in terms of consistency and what typeof delivers. Let us look at a few examples - 1 2 const i = 1; console.log(typeof i); // number typeof is a unary operator, and does not require brackets.

Array `copyWithin` - what's the point?
· ☕ 2 min read
You must have seen the copyWithin() method for an array, and surely wondered what it can do. copywithin copies elements from one position to another position in the same array. (Just kidding about the wondering thing - no one ‘wonders’ today, they just Google). 1 2 3 4 const fruits = ["apple", "orange", "grapes", "banana"]; fruits.