How do I log bobsollowers and tinasFollowers in one array

how do I console.log the variables:, bobsFollowers and tinaFollowers, in one line? they have no assigned variable or anything so how do I go i log them?

hi @awesomecoder139 ,

If you do understand how to log a string message using console.log() method, then for variables wise likely be the same.

Example 1 - using the ’ + ’ (plus operator) to concatenate string values.

Example 2 - using Template Literals (the application of back ticks `   `  )

Hope it helps.

Ok I did it I did try your method it didn’t work but it turns out all I needed to do was just type bobsFollowers[i]. chuckles like spongebob

1 Like

@awesomecoder139 that’s great to hear your issue has been resolved! Cheers to more learning in the current computer language and more after.

On a side note, it would be nice to phrase your title and problem statements in details as much otherwise, the community volunteers will second guess or have to create multiple examples to tackle one root problem.

Based on your response, your question title sounds like “How do I log bobsollowers and tinasFollowers arrays in one console.log statement” and your problem statement should state the variables are arrays from the beginning, and you would like to know how to access the value within the arrays (you can refer to the following codebyte example for more).

const bobsollowers = ['peter', 'james', 'john']; const tinasFollowers = ['henry', 'george', 'aaron']; // Examples console.log("Bob's followers are... " + bobsollowers[0] + ", " + bobsollowers[1] + ", and " + bobsollowers[2]); console.log(`Tina's followers are... ${tinasFollowers[0]}, ${tinasFollowers[1]}, and ${tinasFollowers[2]}`);

Thanks :grinning_face_with_smiling_eyes:

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.