I have a JavaScript class Test that has a private function foo that looks like this:  function Test(){} (function() {     var foo = function(){         // do stuff         console.log('private work');     }      this.publicStuff = function(){         foo();     }  }).apply(Test);   and one that looks like this  function Test(){} (function() {     function foo(){         // do stuff         console.log('private work');     }      this.publicStuff = function(){         foo();     }  }).apply(Test);   they both work OK and do same stuff and can even coexist like this:  function Test(){} (function() {     var foo = function(){         // do stuff         console.log('private work VAR');     }      function foo(){         // do stuff         console.log('private work FUNC');     }      this.publicStuff = function(){         foo();     }  }).apply(Test);   But when they are together, the var foo = function() gets executed and the other one not.  What is the difference between the two ways of defining these private functions, what is the best practice and what are the advantages/disadvantages of each aproach
I've recently started maintaining someone else's JavaScript code. I'm fixing bugs, adding features and also trying to tidy up the code and make it more consistent.  The previous developer used two ways of declaring functions and I can't work out if there is a reason behind it or not.  The two ways are:  var functionOne = function() {     // Some code };     function functionTwo() {     // Some code }   What are the reasons for using these two different methods and what are the pros and cons of each? Is there anything that can be done with one method that can't be done with the other?
If you are falling, can you Misty Step to the ground to avoid damage? If I fall off a cliff - say, 1000 feet - can I wait (readied action?) until I am near enough to the ground (my understanding is you fall 500 ft/round) then  safely to the ground? Or, does the momentum from the fall carry over through the teleport and I still splatter across the rocks? When clicking &quot;edit&quot; I see:  Your edit will be placed in a queue until it is peer reviewed. We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.  Like:     Likewise, when I am not logged in, clicking &quot;improve this question&quot; or &quot;improve this answer&quot; shows:  You are not . Your edit will be placed in a queue until it is .  And when I click 'Save', I get:  Thanks for submitting an edit. It is only visible to you until it's been approved by trusted community members  Like:     Who can suggest an edit? Where do suggested edits go? Who can vote on a suggested edit? How do suggested edits get reviewed? Can I earn reputation? What about abuse or bad edits? Sometimes the Community user approves or rejects my edit. Why is that? When can I not suggest an edit? Is there a minimum change requirement for a suggested edit? How do I check my suggested edit history? I disagree with the reasons why my suggested edit was rejected. What can I do? How do I know whether there are edits waiting for review? Someone suggested an edit to my own post, and the reviewers took the wrong action. What can I do? Are tag wikis included in this scheme? What do the &quot;Improve Edit&quot; and &quot;Reject and Edit&quot; buttons do? Why are apparently valid links to rejected edits resulting in 404 errors?   For more information about editing, see &quot;&quot; in the . Creating Text Elements using ArcPy? macOS Sierra restarting download instead of resuming /boot full of kernels – what to delete? We have some Ubuntu 16.04 servers. unattended-upgrades are automatically enabled since 16.04 and /boot is a separate partition. Due to the automatic security updates, the boot partition is running out of space with new kernels. We can't reboot the systems (for availability reasons), so the machine is still using the penultimate kernel. Which kernels should I remove? All but the current, the oldest and the newest? Do you guys have some recommendations? I have also noticed that the newest kernel has the status &quot;Half Configured&quot;. This kernel would probably not work, so should I remove this one and use an older kernel? Output of dpkg -l | grep linux-image: ii  linux-image-4.4.0-21-generic --&gt; old kernel ii  linux-image-4.4.0-34-generic --&gt; current kernel ii  linux-image-4.4.0-36-generic --&gt; new kernel ii  linux-image-4.4.0-38-generic --&gt; new kernel ii  linux-image-4.4.0-42-generic --&gt; new kernel ii  linux-image-4.4.0-45-generic --&gt; new kernel ii  linux-image-4.4.0-47-generic --&gt; new kernel ii  linux-image-4.4.0-51-generic --&gt; new kernel ii  linux-image-4.4.0-53-generic --&gt; new kernel iF  linux-image-4.4.0-57-generic --&gt; new kernel Why did the first Linux developers choose to implement a non-preemptive kernel? Is it to save synchronization?  As far as I know, Linux was developed in the early '90s, when PCs had a single processor. What advantage does a non-preemptive kernel give in such PCs? Why, however, the advantage is reduced by multi-core processors? Making dual power supply from single for opamp? For the circuit of opamp 741. we have to supply the dual power for it. How can I make a dual power supply from single. For example, make a (+9V)-GND-(-9V) from single 9V battery ? I have a third-party library which consists mainly of a large number of static (.a) library files.  I can compile this into a single .a library file, but I really need it to be a single .so shared library file.  Is there any way to convert a static .a file into a shared .so file?  Or more generally is there a good way to combine a huge number of static .a files with a few .o object files into a single .so file? Shuffle an array with python, randomize array item order with python What's the easiest way to shuffle an array with python? Compiling a document with PGFplots processing only every x-th data point? What if the LHC doesn't see SUSY? A question in four parts.   What are the main problems which supersymmetry purports to solve?  What would constitute lack of evidence for SUSY at the proposed LHC energy scales (e.g. certain predicted superpartners are not in fact observed)?  Are there alternative theoretical approaches which would address the SUSY problem set and which would still be credible in such an LHC no-SUSY-scenario? Where would LHC-disconfirmation of SUSY leave String Theory?   I would like to think that these four points could be taken together as one question. Payment from Apple for developer where do I use Database. Methods? I m trying to understand where we use following Database.Methods. I know if we want to insert a record to an object we use DML Statement. What i want to know is why/where we use Database. methods. It might be silly question. Database.saveResults Database.insert Database.query Database.Query Database.error   really appreciate the inputs. Thanks a ton in advance. How to prove this inequality $ x + \frac{1}{x} \geq 2 $ I have a cartoon character (a lion) that is part of my business logo that I want to put into Blender and animate it somehow. Is there any way I can take a flat picture (JPEG) and transform it into a 3D image and then animate it in Blender? Proof of $\int_0^\infty \left(\frac{\sin x}{x}\right)^2 \mathrm dx=\frac{\pi}{2}.$ Stack Exchange- Area 51 Android App I am trying to use Stack Exchange Andoid App to use my accounts in Stack Overflow &amp; Area 51.   For the Area 51, there is only Area 51 Discussion. Even Area 51 Discussion isn't working in the App!   VERSION 1.0.51  When adding this site, it's showing the correct full name as in this screen-shot:     However, when I pin this site to my fav sites in Stack Exchange, it is showing: Unknown Site. When clicking it, it shows black screen then just quit the App!  Here is the screen-shot:       Is the site not yet capable with Android? or is it a bug in the App itself?  PS: this question isn't duplicate:   In the previous versions of the App, the site was opening but with Unknown Site name. However, in this version, it quits the app when pressing the area site! It isn't opening at all! This question is also to track this bug in the App. As it's about the site name issue &amp; the content as well. How to tell the probability of failure if there were no failures? I was wondering if there is a way to tell the probability of something failing (a product) if we have 100,000 products in the field for 1 year and with no failures? What is the probability that one of the next 10,000 products sold fail? checking if a number is a prime I was reading Wikipedia, and it was given that "all primes are of the form 6k ± 1"  (other than 2 and 3), where k = 1,2,3,4,...  Is this statement correct? If yes, can we use this to test if a given number is a prime number? For instance, we can say that 41 is a prime number, since there exists an integer K (K >= 1), such that 6k - 1 = 41 ==> k = 7.  I am confused why this test cannot be used to test if a number is prime?  Thanks, Sekhar When I search for similar questions that I am going to ask, I usually can't find anything through the search box on Stack Overflow. But when I enter my question on the &quot;Ask Question&quot; page, the questions suggested through the &quot;Questions with similar titles&quot; box are usually relevant. Do you experience the same thing?