I am working on an javascript app and having some trouble with the object constructor.  I am going to make each card in the deck an object and so just working on building an array of those objects.  Here is what i have :        function card(suit1,number1) // Constructor     {     this.suit1 = suit1;     this.number1 = number1;     }       function makeDeck1() {     var deck1 = new Array()        deck1[0]= new card('S','A');     deck1[1]= new card('S','1');      }       function myFunction() {  makeDeck1();     alert('gman' + deck1);      }     &lt;h2&gt;Blackjack&lt;/h2&gt;      &lt;button onclick="myFunction()"&gt;Click me&lt;/button&gt;     basically the console is telling me that "deck1" is not defined...so something is wrong with the process...  was wondering if anyone can shed any light on this.  Thanks!  G
What is the scope of variables in javascript? Do they have the same scope inside as opposed to outside a function? Or does it even matter? Also, where are the variables stored if they are defined globally?
I was reading . They are performing a logistic regression (with R). At some point they calculate the probability of getting a residual deviance higher than the one they got on a $\chi^2$ distribution with degrees of freedom equal to the degrees of freedom of the model. Copying-pasting from their website...   &gt; glm( cbind(using,notUsing) ~ age + hiEduc + noMore, family=binomial)  Call:  glm(formula = cbind(using, notUsing) ~ age + hiEduc + noMore,            family = binomial)   Coefficients: (Intercept)     age25-29     age30-39     age40-49       hiEduc       noMore       -1.9662       0.3894       0.9086       1.1892       0.3250       0.8330    Degrees of Freedom: 15 Total (i.e. Null);  10 Residual Null Deviance:      165.8  Residual Deviance: 29.92        AIC: 113.4        The residual deviance of 29.92 on 10 d.f. is highly significant:  &gt; 1-pchisq(29.92,10) [1] 0.0008828339       so we need a better model     Why does it make sense to compute 1-pchisq(29.92,10) and why does a low probability indicate that something is going wrong with their model? I would like to see a full how-to guide on how to install Ubuntu. How to partition an encrypted disk In the double-slit experiment of electrons (observed by photons), is it correct to say the collapse is caused by the momentum of the photons? I'm working off the article, . I think it's well-written, but I'm not convinced about this part:     So what is causing the change in the particle’s behaviour?      In the example given above, when electrons are fired at a fluorescent screen, when we bombard the electrons with photons the interaction changes the state of the system catastrophically as, despite lacking mass, photons do carry momentum.   Here the author strongly implicates the momentum of photons as being responsible for the collapse. But is that correct to say?  I have read that the  verified that obscuring which-way information restores wave-like behavior. So it feels to me it's more about some "outer" state (perhaps well-characterized as "information") that we don't yet understand that collapses the system, not per se the photon-electron interaction.  Or am I wrong, and in fact for example, the process of obscuring in the quantum eraser experiments somehow "undoes" the photon-electron interaction or restores the quantum state through another interaction? How do I transition to SSL without affecting PageRank? Where in Europe can I purchase a car without residency? I am not a resident anywhere and plan to travel for the foreseeable future, mostly in Europe. My country has good visa-free access to most of Europe, so it is conceivable I could remain without any residency for quite some time.  I enjoy driving, and maintaining cars, and I would like to purchase a car somewhere in Europe.  Where, if anywhere, in Europe (or outside of Europe, but with the ability to drive the car in Europe) can I legally purchase and insure a car as a non-resident? I am open to creative solutions like setting up a company to own the car, if the capital and ongoing paperwork requirements for the company are not too onerous.    I am aware that I could save money, get places quicker, etc, by taking trains or flying. I have a passion for cars and driving. Suggesting that I not buy a car is out of scope of this question. How to edit `postgresql.conf` with pgAdmin 3? Using media queries in Lightning component OneDrive for Windows 10 - Remove logged out account In university last semester I was asked to prove that $\sin1$ (1 radian that is) is irrational,  and ended up simply using the Taylor Series Expansion. This method provides a very quick solution, but I am curious as to whether anyone has a method for proving this without making use of the Taylor Series Expansion. I feel as though doing so must be possible using some number theory, but am low on ideas as to an alternative approach to the question.  Note:  If anyone is interested in my solution using Taylor Series Expansion (although it is not the focus of my question), here it is :      From    $$ \sin x = x - \frac{x^3}{3!} + \frac{x^5}{5!} -  \dots$$   We see that    $$ \alpha = \sin 1 = 1 - \frac{1^3}{3!} + \frac{1^5}{5!} -  \dots $$   Given integers $a$ and $b$, if $\alpha = \frac{a}{b}$ then it follows that $b!\alpha \in \mathbb{Z}$, and $b!\alpha = C + D$ where $C \in \mathbb{Z}$ and we have :   $$ D = \begin{cases} \pm(\frac{1}{b+1} - \frac{1}{(b+1)(b+2)(b+3)} + \dots) \text{    if $b$ is even}\\ \pm(\frac{1}{(b+1)(b+2)} - \frac{1}{(b+1)\dots(b+4)} + \dots ) \text{ if $b$ is odd}\\ \end{cases} $$   In each case we can see that $0 &lt; D &lt; 1$, giving us a contradiction.    Thus, we have that $\sin 1 $ is irrational.    $$ \blacksquare $$ Prove that $\prod_{k=1}^{n-1}\sin\frac{k \pi}{n} = \frac{n}{2^{n-1}}$ Using $\text{n}^{\text{th}}$ root of unity  $$\large\left(e^{\frac{2ki\pi}{n}}\right)^{n} = 1$$  Prove that   $$\prod_{k=1}^{n-1}\sin\frac{k \pi}{n} = \frac{n}{2^{n-1}}$$ I think the title says all I want: I want to add context menu items for a specific file type like the yellow marked ones in the screenshot. Which registry changes do I have to make? In my case I want to assign ir.exe to .rb files. App Store asks for old Apple ID when installing updates I got a MacBook that a colleague of mine had used previously. It runs OS X 10.10.2. I created a new administrator account for myself and turned off the "admin" flag on the old account.  I also entered my iCloud / Apple ID account, so that it syncs my calendars and contacts correctly, and even in the App Store, I am signed in with my correct account.  But when I try to install pending software updates (that is, OS X system updates!), the window that pops up has the the e-mail address of my colleague filled in and greyed out—and I can't change it.     Note that I'm signed in with a different (correct) account in the App Store. When I go to Featured and click Account on the right, it has my correct e-mail address filled in:    How do I make the App Store "forget" the old Apple ID?  I  where it just says "it's not possible", and that apps are glued to the original account the Mac was set up with, but that doesn't make a lot of sense, especially in a company where laptops may be handed over from one person to another. Sci-fi book where humanity is rebuilt on a new planet after being wiped out How to trim whitespace from a Bash variable? How would I identify what's causing my Mac to permanently hang on shutdown? Whenever I try to shutdown or reboot my Mac (Macbook Pro 15" Retina late 2013, OS X 10.11.3) it closes all programs like normal and then it goes into that black screen with the progress bar. When it gets to about halfway it permanently hangs and won't ever finish rebooting. I looked at the log viewer and couldn't find anything in particular. Is there a way to monitor a shutdown more closely and find out what's causing it to get stuck? How to change default user in WSL Ubuntu bash on Windows 10 A real $2 \times 2 $ matrix $M$ such that $$M^2 =  \begin{pmatrix} -1&amp;0 \\ 0&amp;-1-\epsilon  \\   \end{pmatrix}$$ (a) exists for all $\epsilon &gt; 0$. (b) does not exist for any $\epsilon &gt; 0$. (c) exists for some $\epsilon &gt; 0$. (d) None of the above is true.  Attempt: I couldn't think of any theory base to prove / disprove the existence of such a matrix. Could someone please give me a hint on how to go about this problem? Thank you very much for your help in this regard. What is the VTable Layout and VTable Pointer Location in C++ Objects in GCC 3.x and 4.x? An error of Graphing Calculator Desmos? Can someone explain to me this error of the Desmos graphic calculator? Why ? For other values of $x$, the exact value of $f(x)$ is obtained.  Or am I wrong when I assure that $f(\sqrt2)=0$?