Follow-up question here. Has anyone tried employing .charAt()
which is given as alternate method in hint #2?
I’m probably doing things wrong, but it doesn’t seem to be recognizing .charAt()
.
const animals = [‘hippo’, ‘tiger’, ‘lion’, ‘seal’, ‘cheetah’, ‘monkey’, ‘salamander’, ‘elephant’];
const startsWithS = animals.charAt(letter => {
return letter[0] === XXXX
});
I didn’t finish the code block (hence the gibberish) because regardless of what I put in, it didn’t get past the fact that it wasn’t recognizing .charAt()
. I’m getting the error:
/home/ccuser/workspace/javascript-iterators-find-index/main.js:12
const startsWithS2 = animals.charAt(letter => {
^
TypeError: animals.charAt is not a function
at Object.<anonymous> (/home/ccuser/workspace/javascript-iterators-find-index/main.js:12:30)
Any ideas? Am I missing something obvious?