Remove console.log() before publishing site?

Should all console.log() statements be removed from one’s code before you publish the site? Is it good practice to remove them?

If you do not remove them, can people see them if they click ‘Inspect element’ or open Developer tools on Chrome?

  1. Removing all logs might made your debug harder, like a error message with no clue on what creates the error.

  2. Optional, normal users won’t open the dev console.

  3. Yes, everyone can see.

People can see all your front-end code files, (you can see them in the browser dev tools sources tab). If you leave the console.log there, it will log to the console.
You should remove every line that you only added for developing purpose.

Also, just to add Alex, that any logs you’ve written in backend files like data.js, http-functions.js and events.js will only be visible by you, no visitor will be able to see them. If you want to be able to see these console.logs for your live site, you can use the Site Events monitoring tool built into your websites - Velo: Viewing Live Site Events | Help Center |

Ahh ok, I was not aware of that – thanks for the tip!

Appreciate the structured answer