<script>
function my_function_for_good_response(response){
console.log(response)
}
my_promise_function(1)
.then((response) => console.log(response))
.catch((response) => console.log(response))
my_promise_function(0)
.then(my_function_for_good_response())
.catch((response) => console.log(response))
function my_promise_function(parameter){
return new Promise((resolve, reject) => {
if (parameter>0){
console.log()
resolve("good response")
}else{
reject('bad response')
}
})
}
</script>
//console:
undefined
good response
bad response
why is ' undefined' printed?if in the second case the response is of reject type
why is 'undefined' printed in the first line?should it be in the second line?
and why doesn't 'my_function_for_good_response' work if it is absolutely the same as the arrow function?