While studying the book 'JavaScript and jQuery Interactive Front-End Web Development', I came across this interesting sentence:
You can create an array using a different technique called an array constructor. This involves using the new keyword followed by Array(); The values are then specified in parentheses (not square brackets), with each value separated by a comma. Another method, item(), can be used to retrieve data from the array.
var colors = new Array('white' ,
'black',
'custom');
var el = document.getElementById('colors');
el.innerHTML = colors.item(0);
I attempted to implement this code but encountered an error message:
Uncaught TypeError: colors.item is not a function