function clone(x) {
  if (x === null) {
    return x;
  } else if (Array.isArray(x)) {
    return [...x];
  } else if (typeof x === 'object'){
    return {...x};
  }
  return x;
}
/* Clone an array or object. Everything else returns itself. */
Clone an array or object. Everything else returns itself.
Clone an array or object . Everything else returns itself .
function clone(x) {
  if (x === null) {
    return x;
  } else if (Array.isArray(x)) {
    return [...x];
  } else if (typeof x === 'object'){
    return {...x};
  }
  return x;
}
function clone ( x ) { if ( x === null ) { return x ; } else if ( Array . isArray ( x ) ) { return [ ... x ] ; } else if ( typeof x === 'object' ) { return { ... x } ; } return x ; }
Clone an array or object.
Clone an array or object .