I have a query about spacing in arrays. When I run the following code:
let myArray = [1,2,3,4,5,6,7,8,9,10];
let myOtherArray = ['a','b','c','d','e','f','g','h','i','j'];
console.log('My array = ', myArray);
console.log('My array = ', myOtherArray);
I get the following output:
My array = [
1, 2, 3, 4, 5,
6, 7, 8, 9, 10
]
My array = [
'a', 'b', 'c', 'd',
'e', 'f', 'g', 'h',
'i', 'j'
]
It looks to me that the ‘5’ in the first output has a leading space. Am I correct in assuming that this is just some sort of weird formatting and not an actual space? I notice the second array outputs 4 elements per line, rather than 5. Any clues as to how the console decides on this (4 elements rather than 5, apparent space insertion)?
Thanks for looking.