-2

Code:

let myClassFellows=[ ['Noor',1],['Jawaria',2]];
console.log(myClassFellows[0]);

Below is the output I want to show without the square brackets

2
  • 1
    Why? That's just the way how your browser logs an array to the console. Commented Oct 22, 2020 at 6:57
  • You are right. But I just wanted to remove those square brackets from my output. I tried this myClassFellows[0].join(', ') and got the desired output. Commented Oct 22, 2020 at 17:47

1 Answer 1

1

What do you mean without square brackets? Like 'Noor', 1? If so, you need to concatenate it into a string with myClassFellows[0].join(', ').

Sign up to request clarification or add additional context in comments.

4 Comments

It's working! I got my desired output. Thank you so much!!
Can you please answer if I want to show the output of this whole code, let myClassFellows=[ ['Noor',1],['Jawaria',2]]; without square brackets. My Output would be like Noor,1 Jawaria,2. What would be the code to get such output without brackets for all array elements.
I did it with this code: console.log(myClassFellows+ ' ');
Did that answer your question? If so, don't forget to mark this answer as the correct one :)

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.