Skip to content

LIS - PTWD - FEB - Rui Pereira - #743

Closed
RuiMPer wants to merge 2 commits into
ironhack-labs:masterfrom
RuiMPer:master
Closed

LIS - PTWD - FEB - Rui Pereira#743
RuiMPer wants to merge 2 commits into
ironhack-labs:masterfrom
RuiMPer:master

Conversation

@RuiMPer

@RuiMPer RuiMPer commented Feb 11, 2020

Copy link
Copy Markdown

@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
Copy Markdown

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

stale Bot commented Mar 13, 2020

Copy link
Copy Markdown

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

stale Bot commented Mar 15, 2020

Copy link
Copy Markdown

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