I'm building a user form,
in which I added some `console.log()` statements for fast debugging.
but I noticed that if there's an error inside the `console.log()` E.g: `Uncaught TypeError: Cannot read property 'formatted_address' of undefined`,
then the rest of the function stops executing.
Which is weird to me.

Here's the code:

```
function submitted(e) {
  console.log(typeof autocomplete.getPlace());
 console.log("Location: ", autocomplete.getPlace().formatted_address); //this can result in undefined
  const selectedCat = category.options[category.selectedIndex].value;//this can result in undefined if 
                                                                        nothing is selected

//----If any of the above throws an undefined error than the code below won't execute----

  const data = {
    name: bizName,
    email: bizEmail,
    location:
      typeof autocomplete.getPlace() !== "undefined"
        ? autocomplete.getPlace().formatted_address
        : bizAddress,
    owner: {
      firstName: ownerFname,
      lastName: ownerLname,
    },
    phone: phone,
    website: bizUrl,
    category: selectedCat,
    logo: "https://s3.amazonaws.com/uifaces/faces/twitter/picard102/128.jpg",
  };

  console.log(data);

  postData("/business/create", { answer: 42 }).then((data) => {
    console.log(data);
    //check for errors from server validation
    if (data.errors) {
      alert(data.errors[0].msg);
    }
  });

  e.preventDefault();

  console.log();
  console.log(e);
}

```

How can I prevent this from happening? Or is something else causing the function to stop running?
Thanks in advance