Variations of using Return / Console.log() inside and outside a function block

I seem to be using return when the guide says console.log(), and vice-versa. Can anyone please explain the differences between the following, and why I would use one over the others?

Return, Console.log() outside the function

const myFunction = () => { return 'string'; } console.log(myFunction());

No Return, Console.log() inside the function

const myFunction = () => { console.log('string'); } myFunction();

Return, No Console.log()

const myFunction = () => { return 'string'; } myFunction();

When there is nothing to assign. then there is nothing to log. In that case, log inside the function since it is basically procedural. Do this and get out, kind of thing.

When there is usable data to evaluate further down the road in the program, then return it, assign it, and if needs be, log it then, or at in some later report. The point is we have a it to reference later.

To be truly re-usable and portable, a function will return a value or throw an error or something if it is not being properly implemented. When we employ function return values in our code, we need to be able to trust those values else we cannot successfully move on or have any confidence in the output. But again, with returns we still have the option to further validate. return permits data flow. There is no data flow when a function logs out its results.