Author: Hiral Patel

Introduction to Regular Expression in Javascript

Regular expression are patterns to match in a string. A regular expression in javascript is an object type. This post gives an introduction on how to write a regular expression in javascript. Moreover, it gives quick reference using example on special characters of regular expression. Check out Regular Expression Usage post to know more about regular expression usage. Create Regulare Expression Object You can use following 2 ways to create regular expression. Method 1 : Using regular expression literal /pattern/flags notation is used to create regular expression. //String var str = "Smooth Programming"; // Regular Expression // We have...

Read More

6 ways to iterate an array in javascript

There are many ways to iterate an array in javascript. This post shows 6 most popular way of iterating an array in javascript. Initialize Consider following is the array we are going to work with in our example. var arr = ["apple", "banana", "watermelon", "cherry"]; Method 1 : Using sequential for loop This is the most well known method for iterating an array in javascript. It is recommended to use for loop if index access order is important in iteration for(var i = 0; i < arr.length; i++) { console.log(arr[i]); } // outputs: apple, banana, watermelon, cherry Method 2...

Read More

How to use Git in Sublime Text

Git is a very popular version control system and Sublime Text is very popular text editor tool. If you are new to sublime text editor then I recommend you to read Sublime Text Plugins, Tips and Settings. This post explains step by step on how to use Git plugin into Sublime Text editor to increase development productivity. There are many plugins available in package control for Git integration in sublime text. My personal favourite is Git, which I am going to discuss in this post. Install Github on Your Machine If you have already installed Github on your machine...

Read More

Array vs Object vs JSON in Javascript

Array, Object and JSON is most widely used terms in Javascript. This posts explains in detail what is the difference between array, object and json. In simple words, arrays and objects are data structure to hold your data and JSON is the format to marshal(serialization) or unmarshal (deserialization) data. Initialization of Arrays and Objects // Array var arr = []; // This is basic syntax for array in javascript. typeof arr; // outputs object Array.isArray(arr); // outputs true arr instanceOf Array; // outputs true. // Objects var obj = {}; // This represents objects in javascript. typeof obj; // outputs...

Read More

Debug Live WordPress Site on Local Server

This post explain in detail how to debug live WordPress Site on Local Server. This is a step by step guide on how to move live website on local machine and set up debug parameters on local environment for WordPress site. Step 1: Set up Local Machine for WordPress site Hosting using MAMP WordPress uses Apache web server for running PHP scripts and MySQL database to store data in the backend. MAMP is an easy to set up personal web server. It quickly set up MySQL and Apache server on your local machine. Download and install MAMP server on your local...

Read More