Home > Enterprise >  How to make a function return the result in console?
How to make a function return the result in console?

Time:12-09

let numbers = [1,5,22];
let doubledNumbers = numbers.map(n => n*2);
    
function doubledNumbersFn() {
    return numbers.map(n => n*2)
}
    
doubledNumbersFn();

When I run these codes at

enter image description here

I see the result on the right, but when I ran it on JSfiddle I don't see anything.

CodePudding user response:

You would need to run console.log(doubledNumbersFn()) in order for it to be published to console.

  • Related