Clone array in Javascript
How to clone array in javascript? how to duplicate an array in javascript? that’s usual question we come across then people start saying use loops and copy one array to other. because if you directly assign one array to other variable it’s actually assigned via reference. so either way you change it’s reflected in both variables ! How to clone or duplicate array in simple steps let’s find it out! Array.prototype.clone = function() { return this.slice(0); };   Now how …
Read Querystring using Javascript
Many times we come across scenarios where we want to read QueryString value in javascript. There is no direct way in which we can read the value. On server side we can use something like //PHP $_GET //ASP.NET Request.QueryString But in Javascript there is no direct way to read like server side code. Usually these scenarios of reading Query string values from client side come when we are trying to use AJAX on our pages. So what to do in …
Javascript function to Read Cookie by Name
Most of the times we come across situations where we need to read cookies using javascript. Javascript has a built in property for document object called as cookie which is useful for getting cookies. But problem with this property is it actually returns all the cookies as string! so you will end up getting values like “cookie1=val1; cookie2=val2; cookie3=val3” So to take care of splitting the string and getting value for only required cookie I tend to use small function which basically expects name of …