I think this is fairly straightforward but I am not sure.  I am trying to insert copies of an object into an array, changing the value of some of them.  Ideally I would like to do this without a constructor function.  Here is what I have:  var person = {   gender: 'Male',   age: 50 }  var people = [];  for (var i = 0; i &lt; 5; i++) {   var favoriteWord = "hi";   person.favoriteWord = favoriteWord;   people.push(person); }  for (var i = 0; i &lt; 5; i++) {   var favoriteWord = "goodbye";   person.favoriteWord = favoriteWord;   people.push(person); }  console.log(people)   What happens is that every item in the array takes on the same favoriteWord property. In essence all of the items in the array are the same.  Is there a way to change this or do I have to use a function?
What is the most efficient way to clone a JavaScript object? I've seen obj = eval(uneval(o)); being used, but . I've done things like obj = JSON.parse(JSON.stringify(o)); but question the efficiency.  I've also seen recursive copying functions with various flaws.  I'm surprised no canonical solution exists.
how does capacitor work ? how do they conduct electricity ? Sorry, i am novice in electronics, trying to understand basic fundamental of electronics.  1. How does capacitor conduct current when two plates aren't physically connected. CSS Display an Image Resized and Cropped I want to show an image from an URL with a certain width and height even if it has a different size ratio.  So I want to resize (maintaining the ratio) and then cut the image to the size I want.  I can resize with html img property and I can cut with background-image.  How can I do both?  Example:  This image:     Has the size 800x600 pixels and I want to show like an image of 200x100 pixels   With img I can resize the image 200x150px:  &lt;img      style="width: 200px; height: 150px;"      src="http://i.stack.imgur.com/wPh0S.jpg"&gt;    That gives me this:    &lt;img style="width: 200px; height: 150px;" src="https://i.stack.imgur.com/wPh0S.jpg"&gt;       And with background-image I can cut the image 200x100 pixels.  &lt;div      style="background-image:            url('https://i.stack.imgur.com/wPh0S.jpg');      width:200px;      height:100px;      background-position:center;"&gt;&amp;nbsp;&lt;/div&gt;    Gives me:        &lt;div style="background-image:url('https://i.stack.imgur.com/wPh0S.jpg'); width:200px; height:100px; background-position:center;"&gt;&amp;nbsp;&lt;/div&gt;      How can I do both?  Resize the image and then cut it the size I want? A very easy probability problem but opinions diverge greatly. Need some help. The question itself is a very easy one:     Somebody has got two kids, one of whom is a girl. Then what's the probability that he's got at least one boy?   My answer is that, since he's already got a girl, then "he's got at least one boy" amounts to "the other kid is a boy", whose probability is apparently $\frac{1}{2}$. But my friends argue that the probability should be $\frac23$: they say this is a binomial distribution, all the possible cases are (girl,girl),(girl,boy),(boy,girl) which yields that the probability is two cases out of three and is thus $\frac23$. But I think this is totally unacceptable. I don't think it is a binomial distribution at all, at least not what my friends explained to me. However, I just can't disuade them of their opinion, nor can I prove that I am wrong. So what on earth is the probability? and why? Any help is appreciated. Thanks in advance. Esp. Can anybody show why my explanation is wrong? Isn't it that whether the other kid is a boy or a girl a 50/50 event?  EDIT: Thanks for all the help you provided for me, and special thanks will go to @HammyTheGreek and @KSmarts, who have made it clear to me that there is in fact some ambiguity in my statement in this problem. As is pointed in  ,two distinct interpretation of the statement "one of whom is a girl" that gives rise to ambiguity:     From all families with two children, at least one of whom is a boy, a family is chosen at random. This would yield the answer of 1/3.   From all families with two children, one child is selected at random, and the sex of that child is specified to be a boy. This would yield an answer of 1/2. Is there a way to bypass resistance/immunity to fire damage? I want to use fire-based spells for thematic reasons and a lot of things have immunity to it.   Is there a feat or class feature I could use to bypass/reduce those? For example, is there something that ignores fire resistance and reduces fire immunity to just resistance?   I know the easy way around it is just to pick another damage type spell but I really want to roleplay a pyromancer/firebender-type character. How to replace a character by a newline in Vim I'm trying to replace each , in the current file by a new line:  :%s/,/\n/g    But it inserts what looks like a ^@ instead of an actual newline. The file is not in DOS mode or anything.  What should I do?  If you are curious, like me, check the question  as well. For positive invertible operators $C\leq T$ on a Hilbert space, does it follow that $T^{-1}\leq C^{-1}$? Is there a program equivalent to lint for LaTeX? Is there a program equivalent to lint for LaTeX? (lint checks C code for syntax errors and possible mistakes.) I have a 3TB Seagate Backup Plus Desktop USB 3.0 drive, which works fine when in its enclosure, but when I get it off its enclosure and directly plug it as an internal SATA drive, it's just not properly recognized (it works again when used in the enclosure). My systems’s motherboard is an , which has two SATA 6.0 Gb/s and four SATA 3.0 Gb/s ports.  When used as an internal SATA drive Windows 7 asks if I want to format the drive, as if it didn’t have a proper filesystem, and if I use the DISKMGMT.MSC tool (typing that in the start menu) I get completely wrong information about the drive.  It says the drive has 3 partitions (349,31GB of RAW data and two unassigned partitions of 1698,68GB and 746,52GB). This information is plain wrong, since the drive, when used in the USB enclosure, works as a single NTFS partition (2794,52GB). How come it’s shown as 3 partitions without filesystem when connected through SATA?!  Is Seagate using some proprietary way of storing the data when using the drive in its provided USB 3.0 enclosure? I didn’t use any kind of encryption. I just plugged the drive with USB 3.0 and started using it straight away, since it apparently came pre-formatted with an NTFS filesystem. I improved an edit... but did I actually? Long boot delay on Ubuntu loading/splash screen following regular dist-upgrade on clean SSD install (18.04) I'be been running 18.04 since a clean SSD install on the day of it's official release, without issues. Power on to login was seconds (max 10)  Then, I did a regular upgrade this morning:  $ sudo apt update &amp;&amp; sudo apt dist-upgrade   The packages installed/upgraded were:  Install: linux-headers-4.15.0-24:amd64 (4.15.0-24.26, automatic), linux-headers-4.15.0-24-generic:amd64 (4.15.0-24.26, automatic), linux-modules-extra-4.15.0-24-generic:amd64 (4.15.0-24.26, automatic), linux-modules-4.15.0-24-generic:amd64 (4.15.0-24.26, automatic), linux-image-4.15.0-24-generic:amd64 (4.15.0-24.26, automatic) Upgrade: gnome-control-center-data:amd64 (1:3.28.1-0ubuntu1.18.04.1, 1:3.28.1-0ubuntu1.18.04.2), linux-headers-generic:amd64 (4.15.0.23.25, 4.15.0.24.26), gnome-control-center:amd64 (1:3.28.1-0ubuntu1.18.04.1, 1:3.28.1-0ubuntu1.18.04.2), linux-image-generic:amd64 (4.15.0.23.25, 4.15.0.24.26), linux-signed-generic:amd64 (4.15.0.23.25, 4.15.0.24.26), gnome-control-center-faces:amd64 (1:3.28.1-0ubuntu1.18.04.1, 1:3.28.1-0ubuntu1.18.04.2), linux-generic:amd64 (4.15.0.23.25, 4.15.0.24.26)   I rebooted once the upgrade had completed, and noted a 2-3 minute delay on the Ubuntu loading/splash screen (prior to login) (without any progress/activity indicated on the dots).  I powered off and tried to boot again, but am getting this delay consistently now. Also close down is much slower too.  Update #1 (2018-07-03): Analysis on systemd:  $ sudo systemd-analyze blame 3min 53.073s plymouth-quit-wait.service     2min 20.699s snapd.seeded.service          49.949s snapd.service           6.186s NetworkManager-wait-online.service           1.148s dev-sda2.device           1.098s plymouth-start.service   Showing that plymouth-quit-wait.service (which I now believe is related to the Ubuntu loading/splash screen) and snapd.seeded.service were by far the longest running services to initiate. So I compared the times before the dist-upgrade and after:  $ journalctl -u plymouth-quit-wait.service --since today -- Logs begin at Fri 2018-04-27 13:01:30 BST, end at Tue 2018-07-03 12:38:05 BST. -- Jul 03 04:15:43 user-laptop systemd[1]: Starting Hold until boot process finishes up... Jul 03 04:15:46 user-laptop systemd[1]: Started Hold until boot process finishes up. -- Reboot -- Jul 03 04:21:17 user-laptop systemd[1]: Starting Hold until boot process finishes up... Jul 03 04:24:52 user-laptop systemd[1]: Started Hold until boot process finishes up.   Before the upgrade plymouth-quit-wait.service took 3 seconds. After the upgrade it took 3 minutes 35 seconds  $ journalctl -u snapd.seeded.service --since today -- Logs begin at Fri 2018-04-27 13:01:30 BST, end at Tue 2018-07-03 12:42:14 BST. -- Jul 03 04:15:43 user-laptop systemd[1]: Starting Wait until snapd is fully seeded... Jul 03 04:15:43 user-laptop systemd[1]: Started Wait until snapd is fully seeded. -- Reboot -- Jul 03 04:22:47 user-laptop systemd[1]: Starting Wait until snapd is fully seeded... Jul 03 04:24:49 user-laptop systemd[1]: Started Wait until snapd is fully seeded.   Before the upgrade snapd.seeded.service took 0 seconds. After the upgrade it took 2 minutes 2 seconds.  Update #2 (2018-07-06): This morning's boot saw the return of the delay. So I guess we're still waiting for the kernel/plymouth/snapd update.  Update #3 (2018-07-12): The problem seems to be resolved, but I didn't see any update to snap or plymouth, and I'm still running 4.15.0-24 kernel. So I'm not sure which package update fixed the problem, or if it just resolved itself somehow. Reading the bug updates on launchpad it's unclear to me what was done (or is being done) to what package/s. If anyone can clarify that would be very useful. Algebraic closure of $\mathbb{C}(x)$ is isomorphic to $\mathbb{C}$ Let $x$ be transcendental over $\mathbb{C}$. Let $K$ be the algebraic closure of $\mathbb{C}(x)$. How to show that $K$ is isomorphic to $\mathbb{C}$? Label rows of a matrix by characters How to add label to index the rows and columns of the matrix ? because I want to number the line outside the matrix       \[     \begin{array}{lc}       \ Mat_{\varPhi to M} &amp; \left(\begin{array}{@{}ccccc@{}}             1 &amp; 1 &amp; 1 &amp; 1 &amp; 1 \\             0 &amp; 1 &amp; 0 &amp; 0 &amp; 1 \\             0 &amp; 0 &amp; 1 &amp; 0 &amp; 1 \\             0 &amp; 0 &amp; 0 &amp; 1 &amp; 1 \\             0 &amp; 0 &amp; 0 &amp; 0 &amp; 1               \end{array}\right) \\[15pt]     \end{array}     \] How can I prove that $2017 \mid 1^{2017}+2^{2017}+\dots+2017^{2017}$? I tried proving it with the use of modulo, however it was to no avail. Afterwards, I  tried researching, for possible theorems, that may help, but that bore no fruit, either. Can you guys please help me proving it, as I am stuck? Thanking you in advance. Rendered image looks pixelated Issue with regex backreference in Python In Portal, we are promised cake and a party at the end of our tests. However;       we soon discover that the cake is a lie.     Then, at the final scene;       there really is a cake (and my companion cube is waiting for me).   What's the meaning of this?  Was GLADOS not deceiving me? Her comments seem to suggest that;       ...she had the intention of killing me. Was the cake for us (player) and not for the character in the game? Can HTML5 databases and localStorage be shared across subdomains? Please check my simplification for x? Is a URL with a query string better or worse for SEO then one without one? I want to know, is there a huge difference in terms of SEO between these URLs:  example.com/ontario/toronto/listings   or  example.com/listings.php?p=ontario&amp;c=toronto   Will one URL rank higher than the other? Is there a huge difference here? How to prove that orthochronous Lorentz transformations $O^+(1,3)$ form a group? Orthochronous Lorentz transform are Lorentz transforms that satisfy the conditions (sign convention of Minkowskian metric $+---$) $$ \Lambda^0{}_0 \geq +1.$$ How to prove they form a subgroup of Lorentz group? All books I read only give this result, but no derivation.  Why is this condition $ \Lambda^0{}_0 \geq +1$ enough for a Lorentz transform to be orthochronous?  The temporal component of a transformed vector is  $$x'^0=\Lambda^0{}_0 x^0+\Lambda^0{}_1 x^1+\Lambda^0{}_2 x^2+\Lambda^0{}_3 x^3,$$ the positivity of $\Lambda^0{}_0$ alone does not seem at first glance sufficient for the preservation of the sign of temporal component.  And how to prove that all Lorentz transform satisfying such simple conditions can be generated from $J_i,\ K_i$?    For those who think that closure and invertibility are obvious, keep in mind that $$\left(\bar{\Lambda}\Lambda \right)^0{}_0\neq \bar{\Lambda}^0{}_0\Lambda^0{}_0,$$ but instead $$\left(\bar{\Lambda}\Lambda \right)^0{}_0= \bar{\Lambda}^0{}_0\Lambda^0{}_0+\bar{\Lambda}^0{}_1\Lambda^1{}_0+\bar{\Lambda}^0{}_2\Lambda^2{}_0+\bar{\Lambda}^0{}_3\Lambda^3{}_0.$$  And I'm looking for a rigorous proof, not physical "intuition".