I am from C++ background and new to java script and having difficulty understand for loop scope. What is the scope of variable initialized inside for loop.    //Setup var contacts = [     {         "firstName": "Akira",         "lastName": "Laine",         "number": "0543236543",         "likes": ["Pizza", "Coding", "Brownie Points"]     },     {         "firstName": "Harry",         "lastName": "Potter",         "number": "0994372684",         "likes": ["Hogwarts", "Magic", "Hagrid"]     },     {         "firstName": "Kristian",         "lastName": "Vos",         "number": "unknown",         "likes": ["Javascript", "Gaming", "Foxes"]     } ];   function lookUpProfile(firstName, prop){   for(var i=0;i&lt;contacts.length;i++){       if(contacts[i].firstName==firstName){           if(contacts[i].hasOwnProperty(prop))             return contacts[i][prop];           else              return "No such property";         }     }        if (i === contacts.length)     return "No such contact";  }  // Change these values to test your function lookUpProfile("Akira", "likes");     I am confused how  if (i === contacts.length) variable "i" is used outside for loop, variable "i" is initialize inside for loop and if statement is written  out of scope of for loop. Value of document.write(i) is equal to 4 when printed outside loop.Can somebody please explain this?
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?
Why does an object with a glossy shader render in black? When I apply a glossy shader to the material of my text, the text becomes just black. Why?    I have lamp and everything, but the problem persists. The text is red before I add the glossy shader.  I'm using Cycles render.   Thanks! bisectors of an angle in a triangle intersect at a single point - proof verification Let´s consider a general triangle ABC. Let´s draw two angle bisectors from vertices A and B.  It is obvious that these two angle bisectors intersect at a single point X. Since X lies on the angle bisector from A its distance from side b is the same as its distance from side c. As X also lies on the angle bisector from B, its distance from side c is the same as its distance from side a.  By transitivity the distance from the point X to the side b has to be the same as the distance from X to the side a. Therefore the angle bisector from C (which is the set of points equidistant from b and a) has to go through X.  It seems as a very simple argument. Is it correct? What is the connection between special and general relativity? What is the connection between  and ? As I understand general relativity does not need the assumption on speed of light constant. It is about the relation between mass and spacetime and gravity. Can general relativity be valid without special relativity? How to get the caret column (not pixels) position in a textarea, in characters, from the start? How do you get the caret position in a &lt;textarea&gt; using JavaScript?  For example: This is| a text  This should return 7.  How would you get it to return the strings surrounding the cursor / selection?  E.g.: 'This is', '', ' a text'.  If the word “is” is highlighted, then it would return 'This ', 'is', ' a text'. Optional Android notifications for reputation changes I would like to get a notification if my reputation count has changed. I think there is already some internal API for that. (I can see that changes in the menu bar in the top).  I'm sure that some people would not like that so that should be optional. Is it OK to require users to have a third party login account? `testl` eax against eax? I am trying to understand some assembly.  The assembly as follows, I am interested in the testl line:  000319df  8b4508        movl   0x08(%ebp), %eax   000319e2  8b4004        movl   0x04(%eax), %eax   000319e5  85c0          testl  %eax, %eax   000319e7  7407          je     0x000319f0     I am trying to understand that point of testl between %eax and %eax? I think the specifics of what this code isn't important, I am just trying to understand the test with itself - wouldn't the value always be true? In reading through the original GCM specification (), the composition of the 128 bit Initialization Vector as a concatenation of a 96b nonce and a 32b unsigned wrapping counter seems arbitrary and forces the scrambling pattern to repeat every 232 16-byte block.  Is the algorithm expected to be secure for significantly longer stream lengths if for example the IV were a 128b nonce XORed with a 64b or 128b counter, or are there known cryptanalysis issues that begin to arise? Principal $n$th root of a complex number This is really two questions.   Is there a definition of the principal $n$th root of a complex number? I can't find it anywhere. Presumably, the usual definition is $[r\exp(i\theta)]^{1/n} = r^{1/n}\exp(i\theta/n)$ for $\theta \in [0,2\pi)$, but I have yet to see this anywhere. Is this because it has bad properties? For instance, according to this definition is it true that for all complex $z$ it holds that $(z^{1/a})^b = (z^b)^{1/a}$? Unable to format internal drive as APFS on 2018 MacBook Pro When testing the difference between 2 proportions why do we use a z-test rather than a t-test?    Further, is there a simple way to conduct an omnibus test for significant differences between more than 2 proportions (in the form of percentages). Is there an equivalent to a one-way ANOVA for this?  I imagine that you could use logistic regression (assuming you have the original data for the proportions in the form of 0s and 1s) Are there other options? Warning: Total photoshop newb!  I recently got a cool image of my fiancee and I holding hands and showing off her engagment ring. The backdrop is the beach:    I tried to trace an image using a combo of the laso and magic wand tools to select my target. Then I used that to pull out the target as another layer.  I then pasted in a background gradient.     Ended up with a really lame photoshoped looking picture. Notice the white lines where I didn't get the arms close enough and the choppy spots where I got too close.    So what's my main problem here?   Is their a way to bet a better cutout? Is their a blending tool that will make the background look more natural? both   I tried a dozen or so tutorials I found in google searches but they just don't blend these types of images together in any of them. Thanks in advance. Securely erasing all data from a hard drive Push Notification Badge Count Not Updating Increasing post view count automatically How to draw a border around character in a formula? So far everything I found on the matter of borders only applies to the text mode.  I want to be able to do something like  $x_i = y$   so the result will be like the ordinary "xi = z" formula with the border around "i"?  The common answers seems to be the fbox or boxed commands. Yet they render their argument in the standart mode, unless specified to do otherwise with the specific mode. For example, the following code  \[ x_i, \boxed{x}_i, x_{\boxed{i}}, \boxed{x}_{\boxed{i}} \]   produces two normal xi figures, and another two with an oversized i. If a bob attached to a string is swinging in vertical circular motion, we say that the bob leaves the circular path when the tension in the string becomes zero, but even when tension becomes zero, there's always a component of the bob's weight towards the center of the circle. Why then does the bob leave the circular trajectory? I recently got a Windows 10 laptop. Opposite to my Macbook, I must swipe right-to-left to go to the right virtual desktop. Is there a way to reverse this, so I swipe left-to-right to go to the right virtual desktop? Why are neural networks becoming deeper, but not wider? In recent years, convolutional neural networks (or perhaps deep neural networks in general) have become deeper and deeper, with state-of-the-art networks going from 7 layers () to 1000 layers ( in the space of 4 years. The reason behind the boost in performance from a deeper network, is that a more complex, non-linear function can be learned. Given sufficient training data, this enables the networks to more easily discriminate between different classes.  However, the trend seems to not have followed with the number of parameters in each layer. For example, the number of feature maps in the convolutional layers, or the number of nodes in the fully-connected layers, has remained roughly the same and is still relatively small in magnitude, despite the large increase in the number of layers. From my intuition though, it would seem that increasing the number of parameters per layer would give each layer a richer source of data from which to learn its non-linear function; but this idea seems to have been overlooked in favour of simply adding more layers, each with a small number of parameters.  So whilst networks have become "deeper", they have not become "wider". Why is this? Allow suppression of automatic linking of web addresses