I want to call a callback function if one was provided by the user, or default to a default defaultCallback function.
I've done it as follows:
function defaultCallback(x) {
  console.log('default callback ' + x)
}
function test(callback) {
  let x = 'x'
  if (callback) {
    callback(x)
  } else {
    defaultCallback(x)
  }
}
I feel there should be a more concise way of doing this?
 
     
     
    