Goal: I'm trying to create a simple function which checks if a property exists in an object, if it doesn't, the property is then created and the value is assigned to it. Problem: the parameter from the function parameters is not being read.
let b = {
  name: 'Chuck Berry',
  job: 'musician',
  bestTune: 'Johnny Be Good',
};
const propertyChecker = (obj, property) => {
  obj.property = obj.property || 'American';
  console.log(obj);
};
propertyChecker(b, 'nationality');
console.log: {name: 'Chuck Berry', job: 'musician', bestTune: 'Johnny Be Good', property: 'American'} bestTune: "Johnny Be Good" job: "musician" name: "Chuck Berry" property: "American" ---- this should be (nationality: "American")
 
     
    