Skip to content
Advertisement

Issues with an Array.forEach [duplicate]

Hope someone here would be able to help me out.

I am trying to build an Owl-Carousel from an array of objects. but for some reason the array is not been recognized, would appreciate if someone could help to find the mistake I have made here.

The error messages I am getting is:

‘item’ is not defined. and ‘tv’ is assigned a value but never used.

Here you have the code:

JavaScript

Advertisement

Answer

Any expression Javascript should be inside curly brackets “{}” and replace forEach by map cause forEach doesn’t return anything and I notice that you use a function and doesn’t return anything to fix this you can add return before OwlCarousel component or use arrow function with parentheses.

JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement