I want to create a map object in javascript. I came to the following idea:   var a = new Array();  a["key1"] = "value1";  a["key2"] = "value2";   but then how I can find if a particular key exists or not?
As made clear in update 3 on , this notation: var hash = {}; hash[X]  does not actually hash the object X; it actually just converts X to a string (via .toString() if it's an object, or some other built-in conversions for various primitive types) and then looks that string up, without hashing it, in &quot;hash&quot;. Object equality is also not checked - if two different objects have the same string conversion, they will just overwrite each other. Given this - are there any efficient implementations of hashmaps in JavaScript? (For example, the second Google result of  yields an implementation which is O(n) for any operation. Various other results ignore the fact that different objects with equivalent string representations overwrite each other.
In my calculator why does $\sqrt4 -2=-8.1648465955514287168521180122928e-39?$ I have tried this on my Windows 7 calculator with $\sqrt9 -3 $ it too gives some weird answer- ie$1.1546388020691628168216106791278e-37$. And so for any $n$(positive) $\sqrt n^2-n= wierd_ .answer$ Why does this happen? I'm trying to amass a list of physics books with open-source licenses, like Creative Commons, GPL, etc. The books can be about a particular field in physics or about physics  in general.  What are some freely available great physics books on the Internet? edit: I'm aware that there are tons of freely available lecture notes online. Still, it'd be nice to be able to know the best available free resources around.  As a starter:         Table of contents sorted by field (in alphabetical order): Is there evidence of dark matter in our galaxy? Is there evidence of dark matter in our galaxy?  How can we measure this, say, how many percent of the center of our galaxy is dark matter?  I did not find the answer in the question PHP mysqli_fetch_field data type Centre of Lie Algebra $sl_2(\mathbb{F})$ For $L=sl_2(\mathbb{F})$ i.e. matrices with trace zero,  what is the centre i.e. $Z(L)$= {$x\in L : [x,y]=[y,x] \ \forall\ y \in L$}.  I will have to find matrices $A \in L$ such that $AB=BA$ for all $B \in L$. But how to appoach this considering trace is zero here. Say you have the infinitely continued fraction: $$x+\cfrac{1}{x^2+\cfrac{1}{x^3+\cfrac{1}{x^4+\ddots}}}$$ When $x=1$, you can see that it's $$1+\cfrac{1}{1+\cfrac{1}{1+\cfrac{1}{1+\ddots}}}$$ which converges upon the golden ratio $\phi = 1.61803398875...$. What if I were to plug in $x=2$? $$2+\cfrac{1}{4+\cfrac{1}{8+\cfrac{1}{16+\ddots}}}$$ Using a caluclator, it seems to converge upon the irrational number: $2.24248109286...$ Is there any way I can represent this irrational number algebraically? How to replace a string on the 5th line of multiple text files? I want to replace the 5th line of multiple text files (file1.txt,file2.txt,file3.txt,file4.txt) with the string " Good Morning " using a single terminal command.  All the text files are located on my ~/Desktop.  Note: My desktop consists of 6 .txt files.I want to apply the change to above mentioned 4 text files only. Prove that $G$ is abelian iff $\varphi(g) = g^2$ is a homomorphism I'm working on the following problem:     Let $G$ be a group. Prove that $G$ is abelian if and only if   $\varphi(g) = g^2$ is a homomorphism.   My solution: First assume that $G$ is an abelian group and let $g, h \in G$. Observe that $\varphi(gh) = (gh)^2 = (gh)(gh) = g^2h^2 = \varphi(g)\varphi(h)$. Thus, $\varphi$ is a homomorphism.  I'm having trouble completing the proof in the reverse direction. Assume that $\varphi$ is a homomorphism. We then know that $\varphi(gh) = \varphi(g)\varphi(h)$ and $\varphi(hg) = \varphi(h)\varphi(g)$. However, I don't see a way to use this to show that $gh = hg$.  Could anyone lend a helping hand? Best way to randomize an array with .NET Applying for a Schengen Visa without itinerary I am currently residing in Ireland with work authorization permit. In the next few months I am planning for a trip to few schengen countries. I have not yet decided my itinerary. Is there any Schengen country embassy which can process a tourist Schengen visa for 90 days? I'm currently going through notes on a physics course and I'm having trouble understanding the difference between a tensor, a vector, and a matrix. I know that a vector is a kind of tensor and that a matrix is also a form of tensor, but what I'm having trouble understanding is how they differ, and how a vector is related to a matrix. A required field that isn't really required? ...the email field in my clients data entry system is required but users of the system are allowed to enter na@na.com if the customer refuses or doesn't have an email address. Is this best practice? Have any suggestions or workarounds for their solution? How many throws of a die until every possible result is obtained? A die is thrown until every possible result (i.e., every integer from 1 to 6) is obtained. Find the expected value of the number of throws.   How do I do that? I understand that probability for the single result is $\{1, 5/6, \ldots , 1/6\}$, but what about the expected value? I think I have found the final answer $\left(4 \left[\frac{2t \cosh(4t) - \sinh(4t)}{t^2}\right]\right)$ but need to verify it. How come SG-1 couldn't get back to Earth? In Stargate SG-1 S02E16, , SG-1 (Captain Carter, Teal'c and two other members, who replaced Colonel O'Neill and Dr Jackson) is "trapped" on planet in binary system, where second star has risen and is slowly raising temperature - Samantha Carter says, in one moment, that it's going to reach 200°F soon - and dialing device is locked mid-dial. Yet, SGC manages to dial the planet and send them instructions how to repair the device and off-world team makes it back.  Why didn't they come back when Earth first dialed P9Q-281 to contact SG-1? I mean, from my understanding, stargate wormhole is two-directional, meaning it doesn't matter which end it was activated from, yet it seems like it is one-directional from the events of this episode... One of the mysteries that my numerics class left me with are "stiff systems". Our prof didn't really manage to explain what they are. Now that the class (and the test) are over, I'm still curious.   The most concise definition about "stiff systems" I've found so far is: "There is no universally accepted definition of stiffness". So, if there is none, I don't expect one.   I'd be thankful about information on both of the following points:   From what kind of (real-world) problems do stiff systems arise? What's so "stiff" about them? What's the good thing - or the bad thing - that I'd worry about when I have to numerically solve such a real-world problem? We are having issues with our exchange 2013 server. The server is running Windows Server 2008 R2 Standard.  The issue we're having is that our Exchange server isn't receiving internet emails. It can currently send mail out to internet addresses, and send and receive internal emails from the current email server. I have checked the settings of the receive connectors and everything seems correct. We have tried everything that we can think of.   We can send and receive email locally, and send out to a gmail account. However, we don't get the reply email from the gmail account to the inbox.    Thanks in advance!! Image is of the DNS settings on the exchange server. How can I use colours to separate texture node treatment? Why is $\pi$ irrational if it is represented as $C/D$? Can't reset WordPress password I haven't logged onto my blog for years, and have, of course, forgotten the password. I click the 'Forgot' button and get a mail with a link, but that mail already says     Sorry, that key does not appear to be valid.   And sends me round the click to reset, receive a mail, click the link again etc. As if the timeout for password resets has been set to 0.5s or something.  This is a shared hosted blog, so I have full access to cPanel and all of the WP files via FTP, if that helps anything.