Software Engineer. Full-time Bibliophile. Blogger.

An array is an ordered collection of values: each value is called an element, and each element has a numeric position in the array, known as its index.

JavaScript lets us create arrays inside array called Nested Arrays. Nested Arrays have one or many arrays as the element of an array. This might be little confusing in definition but it is very interesting once we dig inside.

Image for post
Image for post

Creating a Nested Array

There are three syntax to create an array in JavaScript. Let’s create nested arrays using those three methods to get an idea of Nested Arrays.

This one is just equating the variable to the array. …

Every value has truth or false values in JavaScript. For example, a `null` value has an associated boolean value of false. Similarly `34` has an associated value of true. We can use this to cast a variable to true or false using the double bang operator.

Image for post
Image for post

Let’s dive deep into what it is and how it works.

The ! in JavaScript, also called bang, is the logical “not” operator. If you place this operator in front of a boolean value, it will reverse the value, returning the opposite.

The Arrays are for JavaScript developers like screws and nails are for carpenters. Hence it is important to know the in and around with how it works. Emptying an array is one of the important concepts involved so here are the few methods I know.

Image for post
Image for post

1) Using length property

The length property returns the number of elements in that array. And if we equate this to 0, we will be able to empty the array elements. This method is quite popular but not the fastest way to do the job.

In JavaScript, you can represent a number as type number (ex. 12), or as a type string (ex. '12'). At times while coding we might have to convert the data from one type to other. I would like to list few of the methods I know of data conversion from number to string and vice-versa.

Image for post
Image for post

Number to String

There is a default string method that converts the data to string. The toString() method returns the value of a String object.

More often we are struck with the simplest problem that can be solved very easily. We know the solution for the problem would be very easy, yet it is hard to come up with the solution. It gets overwhelming with all the new concepts and various things that are available online. This was one such problem for me when I started with JavaScript initially. So today I would like to list out the ways to check if the property exists in an object.

Image for post
Image for post

1) Using Object method hasOwnProperty()

The most common solution would be to use hasOwnProperty() which is one of the common object methods. …

Package.json is a file in the root directory of a Node.js project that holds various information relevant to the project. This file gives information to npm that allows it to identify the project as well as handle the project’s dependencies.

It can also contain other metadata such as a project description, the version of the project in a particular distribution, license information, even configuration data — all of which can be vital to both npm and the end-users of the package.

A package.json file:

  • lists the packages your project depends on
  • specifies versions of a package that your project can…

JavaScript object is a collection of properties, and a property is an association between a name (or key) and a value. And we as developers use it excessively. In the initial days of my programming career, I found it difficult to work with the object manipulation. So today I would like to list out the ways to add, update and delete the properties from an object.

Image for post
Image for post

Add property to an Object:

One can add the property to an object by simply giving it a value. Like below example, we are adding the property of husband and giving the value directly. …

More often I hear people complaining that we don’t have good books written in India . Well, I disagree with them. India is so diverse with so many languages and cultures and if one tries to dig deeper looking for all the best literatures there is no enough time. There are more good literatures in the Indian market as there are in any other countries. I can list out many amazing books in my regional language Kannada that has abundance of knowledge and beauty to it. …

So I was listening to this book called Atomic Habits on Audible the other day which made me think about few things. Habits can make you or break you. It shapes us to a person we never thought we would be. As James clear says in his book, ‘You do not rise to the level of your goals. You fall to the level of your systems’.

After reading his book, I started introspecting and started listing my mundane trivial habits and started wondering if it’s good or bad. I don’t know how I caught these habits but it is just there leaving micro traces all along. …

Got a big list of bugs and bored of debugging? Here are the few tips that makes your life easy while you can add spice and sunshine to your console messages.

We can use%c directive to apply a CSS style to console output. And here are few ways how it is done.

NOTE : Paste the below console commands in your console window (Press ctrl +shift + j for windows)

Image for post
Image for post
Print the console message using simple %c

Add the %c directive as a prefix to the part of the string you want to add style to. …

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store