Want where I use the arrow function so it returns 'correct'.
let mama2 = {
children:12,
surname: true,
town: 'umuadi',
school:'imo state university',
mamaChild:() => {
if (this.surname){
return 'correct'
}else{
return 'failed'
}
}
}
let mama3 = {
children:12,
surname: true,
town: 'umuadi',
school:'imo state university',
mamaChild:function() {
if (this.surname){
return 'correct'
}else{
return 'failed'
}
}
}
I want to know the difference between this two codes why it gives me a different result.
when I run this code on my console the first code gives me the result of 'failed' and the second gives me the result of 'correct'.