Skip to content

Conversation

RuiMPer
Copy link

@RuiMPer RuiMPer commented Feb 11, 2020

@ironhack-LIS-PTWD

all iterations done, going for the bonus.

The code work, but I still don't understand 100% what this expressions mean and what they exactly say to the computer to do. in this case I think that the "+=" is confusing me.
driverName += hacker1.charAt(i)
navigatorName += hacker2[i]

@ironhack-LIS-PTWD
Copy link

Hi Rui,

well done for finishing the lab!

let's look at an example regarding your question:

let characters = "Abc";
console.log(characters)
// output => "Abc"
characters = "def"
console.log(characters)
// output => "def"

in this case you are reassigning a new value to the variable
however with += you are adding to the variable instead

let characters = "Abc";
characters += "def"
console.log(characters)
// output => "Abcdef"

so characters += "def" is essentially the same as
characters = characters + "def" only shorter

So in relation to the lab:
In each iteration of the for loop you are adding to the variable navigatorName character by character hacker2[i].

Hope this helps,
Paula :)

@stale
Copy link

stale bot commented Mar 13, 2020

This pull request has been automatically marked as stale because it didn't have any recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Mar 13, 2020
@stale
Copy link

stale bot commented Mar 15, 2020

This pull request is closed. Thank you.

@stale stale bot closed this Mar 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy