0

I need to print every item in the array without using console.log.

Any solutions?

function wrap(stringBreak) {
  let text = stringBreak.trim().split(' ');
  text.forEach(element => {
    return element;
  });
}
console.log(wrap('this is a test'));

2
  • forEach doesn't return any values. And wrap has no return statement in itself. Commented Nov 2, 2022 at 21:04
  • Did you try just returning text (or just return stringBreak.trim.split(' ');) and logging that? Commented Nov 2, 2022 at 21:08

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.