Bears can get in cars. Keep your doors locked in bear country.
https://en.wikipedia.org/wiki/Churchill,_Manitoba#Polar_bear...
If you want to go backpacking in Svalbard I’ve heard you need to rent a gun and also set up alarm trip wires around your camp. Polar bears are built different.
https://www.bearwise.org/wp-content/uploads/2017/07/efficacy...
With a guns you might need one or more well placed shots, and if you're not trained and proficient, that will be almost impossible if you find yourself in a situation where a bear is charging at you. Pepper spray can be a lot easier to spray in a bear's face in such a situation.
Might be best to have both spray and a gun handy, though.