Count Number of a Character in String In Javascript

In this blog post, we count the number of characters in string In javascript. Such if we a string like: “Hello, codemen. How are you?” In this string, we want to count the number of characters “y”. the result should be 1. Method 1 : Using Match The match() method retrieves the result of matching a string against a regular … Read more

Show Bootstrap Modal on Page Load

In this blog post, we learn, how to open or show bootstrap modal on page load. Generally, we need models to show some information or notice to visiter. There are many types of models are available in bootstrap. we can easily open all types of modal with a simple script. Here I am use  jQuery load event … Read more

How to Compare Two Arrays in Javascript

In this post, we compare two arrays, We have many simple ways to do this task in Javascript. #1: Get the difference between two arrays in JavaScript? To get the difference between two arrays we can use a Filter() function of javascript. The filter() the method creates a new array with all elements that pass the test implemented by … Read more

Check If Element Exists in Javascript

In this post, we check if a certain element exists in the DOM. We have many methods in Javascript to do this task. Method 1: document.querySelector() The Document method querySelector() returns the first Element within the document that matches the specified selector.  If no matches are found, null is returned. Method 2 : document.getElementById() Method getElementById() returns an Element an object representing the element whose id property matches … Read more