I have a JavaScript object like the following: var p = { "p1": "value1", "p2": "value2", "p3": "v
What is the difference between using call and apply to invoke a function? var func = function() { alert(&ap
All I want is to get the website URL. Not the URL as taken from a link. On the page loading I need to be able
I'd like to round at most 2 decimal places, but only if necessary. Input: 10 1.7777777 9.1 Output: 1
I saw this question, but I didn't see a JavaScript specific example. Is there a simple string.Empty avail
I have an array of JavaScript objects: var objs = [ { first_nom: 'Lazslo', last_nom: 'Jam
I have an object x. I'd like to copy it as object y, such that changes to y do not modify x. I realized t
How do I check if a particular key exists in a JavaScript object or array? If a key doesn't exist, and I
I am looking for a JavaScript array insert method, in the style of: arr.insert(index, item) Preferably in jQu
In Java you can use a for loop to traverse objects in an array as follows: String[] myStringArray = {"Hello",
I saw some code that seems to use an operator I don't recognize, in the form of two exclamation points, l
What is the best way to copy text to the clipboard (multi-browser)? I have tried: function copyToClipboard(tex
After an AJAX request, sometimes my application may return an empty object, like: var a = {}; How can I che
The following are two methods of building a link that has the sole purpose of running JavaScript code. Which i
Why does Google prepend while(1); to their (private) JSON responses? For example, here's a response whil
How do I make the first letter of a string uppercase, but not change the case of any of the other letters? For
I'd like to do something like this to tick a checkbox using jQuery: $(".myCheckBox").checked(true); or
Something similar to Unix's timestamp, that is a single number that represents the current time and date.
What is the most concise and efficient way to find out if a JavaScript array contains a value? This is the onl
I'm trying to create globally-unique identifiers in JavaScript. I'm not sure what routines are avai