Understanding Split Method in JavaScript

Image for post
Image for post
Image taken here.

The split method spilt the string into array of substring based on the pattern provided.


let numbersStr = "1,2,3,4,5";let numArray = numbersStr.split(",");console.log(numArray); // ["1","2","3","4","5"]

In the above example , the split method will loop through all the character of the string , if the pattern provided is found then the split method will collect the characters looped before finding the pattern and join all the characters as a string and pushed that string into an array .

If we don’t pass any pattern then the entire string will be pushed to an array and…

Learn how to make requests using XMLHttpRequests

summary of key XMLHttpRequest commands covered in this article
summary of key XMLHttpRequest commands covered in this article
Image source: Author

What Is XMLHttpRequest (XHR)?

  • XMLHttpRequest is an in-built JavaScript object that is used to transfer data between a server and a client without refreshing the whole page.
  • Bu using XHR we can update the page based on the user action.
  • For example, an infinite news feed. (Once the user scrolls down to the end of the page, we make a request to fetch the next article and append the data to the page).
  • Using XHR, we can make both synchronous and asynchronous requests.

Steps to Make a Request Using XMLHttpRequest

  • Create an XMLHttpRequest object.
  • Configure the object with request details .
  • Send request.

1. Create a XMLHttpRequest object

let request = new XMLHttpRequest();

2. Configure the object with request details

To configure the request, we can use the open method of XMLHttpRequest object. …

Learn to check if the primitive value or object present in array in JavaScript

Image for post
Image for post
Photo by Deva Darshan on Unsplash

Checking if a primitive value present in an array

You can use

  • indexOf
  • includes
  • Using normal For loop

method to check if a primitive value present in an array , Consider we have an array

var num = [1,2,3,4,5];


The indexOf() method returns the first index of the element in the array, if the searching element is not present in the array then it returns -1 .

num.indexOf(3); // 2num.indexOf(6); //-1num.indexOf('3'); // -1

The NaN value is not handled in indexOf method.

var array = [NaN];array.indexOf(NaN); // -1

If your array can contain NaN , then you can use includes

Requesting donation for my Badminton Training.

Image for post
Image for post
Image by Vladislav

Hello Reader, My name is Jagathish Saravanan, I am from India. I am currently working as a Web developer , I love my Job , but once I started playing Badminton , I started loving Badminton more that anything , So I have decided to switch my carrer to Badminton, It is hard to manage my training expense , so I started writing Blog in Medium . But medium partner program is not supported in India. So I am requesting you to donate some amount .

You can donate me in PayPal :


Google pay: 8015851838.

Crypto :

Thank you so much for your time

Learn how to generate ASCII art from the image using Python.

Image for post
Image for post
Generated in Python

Steps to convert image to ASCII character

  • Load an image
  • Resize Image
  • Convert image to GreyScale
  • Convert GreyScale data of each pixel into respective ASCII character

Loading an Image using PIL image Library

To load the image we will be using PIL library.

import PIL.Image

def main():
path = input("Enter the path to the image fiel : \n")
image = PIL.Image.open(path)
print(path, "Unable to find image ");

The above code read the image from the path given by the user. …

Learn how to add new columns to the table in PostgreSQL

Image for post
Image for post

Adding columns

We can combine ALTER TABLE &ADD COLUMN to add new columns to an existing table.

ALTER TABLE table_name 
ADD COLUMN column_name1 data_type,
ADD COLUMN column_name1 data_type,

Let’s say we have a table user , with name and age . Now we need to add a new column phone_number .

alter table user 
add column phone_number bigint;

Adding multiple columns

Consider we need to add two more columns, salary and nickname

ADD COLUMN salary int,
ADD COLUMN nickname varchar;

Add Column if not present

With Postgres 9.6 this can be done using the option if not…

Learn how to use Array slice in JavaScript

Image for post
Image for post
Useful slice methods


The slice method of array returns a shallow copy of a portion of the array based on the start and end index passed.

Points to remember

  • Both start and end is an optional argument
  • By default the start is 0 and end is array.length
  • end is index is not considered, means if you slice an array passing start as 0 and end as 5 then, elements from 0th to 4th index will be copied
  • The slice doesn’t affect the source array from which we are performing slice.
  • It only creates ashallow copy.
  • We can also give negative value for start and end index, which indicates an offset from the end of the array. …

Learn how to create browser notification in JavaScript.

Image for post
Image for post

Using Notification API you can display a notification on your website.

Three simple steps to show system notification

  • Check if the browser supports Notification
  • Ask the user for permission to show the notification.
  • Once user grant permission, create a Notification object
  • Show the notification with your custom message

Check Browser support

 typeof Notification !== "undefined"

Ask user Permission

Before asking permission, let’s check if the permission is already granted. To get the notification permission, you can use


It can have 3 values

  • denied → Permission granted
  • granted → Permission granted
  • default →The user choice is unknown and therefore the browser will act as if the value were denied. …


Javascript Jeep🚙💨

Articles related to javascript javascriptjeep.com

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