Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #35954

Re: let and {}

From Luca <please_no@spam.it>
Newsgroups comp.lang.javascript
Subject Re: let and {}
Date 2019-01-03 13:13 -0500
Organization Aioe.org NNTP Server
Message-ID <q0ljc3$17ip$1@gioia.aioe.org> (permalink)
References <q0lao9$1vie$1@gioia.aioe.org> <slrnq2se7a.1f4.jon+usenet@sable.unequivocal.eu>

Show all headers | View raw


On 1/3/2019 11:31 AM, Jon Ribbens wrote:

> 
>> 1) why does this work? i.e. why are wrongGuesses and correctGuesses
>> being assigned correctly?
> 
> Not sure I understand that question.

It seems to me that the only way this works is if the name of the 
variable matters!

in other words, would

let { wrongGuesses2, correctGuesses } = this.state;

still work?

>> 3) why isn't this.gameState "interfering" with what needs to be asigned
>> to what?
> 
> I don't understand this question either.

Same doubt as above. How does the JavaScript interpreter know that 
wrongGuess should not be assigned to gameState?

Thanks a lot for your answers. Very instructive


Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

let and {} Luca <luca@please.nospam.it> - 2019-01-03 10:46 -0500
  Re: let and {} Jon Ribbens <jon+usenet@unequivocal.eu> - 2019-01-03 16:31 +0000
    Re: let and {} Luca <please_no@spam.it> - 2019-01-03 13:13 -0500
      Re: let and {} Jon Ribbens <jon+usenet@unequivocal.eu> - 2019-01-03 20:07 +0000
        Re: let and {} Luca <luca@please.nospam.it> - 2019-01-03 23:45 -0500
  Re: let and {} Martin Honnen <martin.honnen@gmx.de> - 2019-01-03 17:32 +0100
    Re: let and {} Luca <please_no@spam.it> - 2019-01-03 13:14 -0500

csiph-web