I am attempting to retrieve the first character from each element within an array using Javascript. I want to extract the first characters like 1, 4, 7, 2, 5, and 8 from the elements '123', '456', '789', '234', '567', and '890'. Unfortunately, I keep encountering the error message "extractElement is not a function". Can anyone tell me what mistake I am making?"
var characterArray = ['123','456','789','234','567','890'];
var extractElement;
var extractSlicedCharacter;
function extractEachFirstNumber(){
for(counter = 0; counter <= characterArray.length; counter++){
extractElement = characterArray[counter];
extractSlicedCharacter = extractElement.slice(0,1);
}
}