Groceries challenge - Codecademy does not accept this code nor does it reject it?

Below is my code for this challenge

In the previous two challenges, codecademy informed me that ‘I got it’
but here it does not give any feedback.
I am allowed to move to the next chapter in the syllabus

But, I’d like to know if there is a problem with this code???

function groceries(array){
    if (array.length > 1){
    arrayOfitems = [];
    array.forEach(item => {
        for (let key in item) {
    let lastItem = arrayOfitems.pop(arrayOfitems.length-1);
    arrayOfitems.push('and ' + lastItem)
    let str = arrayOfitems.join(', ');
    let lastOccurence = str.lastIndexOf(',');
    str = str.slice(0, lastOccurence) + str.slice(lastOccurence + 1); 

    return `${str}` ;
    } else {
        let str = array[0].item;
        return str;

hi @script4273617210,

The code you posted here seems to be working fine, there’s no issue actually.
On the other end, whether Codecademy accepts your code depends on the marking mechanism. Usually when you finish an exercise, the marker will hint you on the sub-items whether you’ve achieved your goals. Otherwise, you’ll have to redo.

Hope this helps.

Thanks for the reply

As I said I get no hint from the ide that something is wrong and I can go to the next stage in the learning path.
So I’ll assume it is all good. M