Credit Card Checker

function validateCred(arr) { => element * 2)



why does this card print undefined to the console?

Check the solution from your previous post:

It’s the same issue.

I’m honestly not understanding the issue. Can you elaborate on the issue for me if possible?

Oh I think I’m getting it. When you use {}, then you need a return command?

You are using the classic syntax for your function:

function xy(x) {
   return x*2

This is more or less the same as if you use the ES6 syntax:

const xy = (x) => {
  return x*2

There are minor differences like hoisting and the use of this keyword, but that does not matter in this context.

Then there is the shorthand syntax where the return is implicit:

const xy = (x) => x*2



That sounds more clear to me now. Thank you so much for your help!

1 Like