0

I have this function here:

let hello = () => {
    console.log('something')
}

let obj = {validate:[hello]}

console.log(obj.validate[0]()) ==> something, undefined

When I console.log it, it gives me "something" and "undefined". Why it gives me undefined is unclear to me. Thanks so much for helping me out!

Jenny
  • 410
  • 4
  • 8
  • 1
    console.log(obj.validate[0]()) prints _undefined_ because _hello()_ does not return a value. If you return 'abc' in _hello()_, the console would look like this: _something, abc_. – lukas.j Dec 12 '21 at 11:21

0 Answers0