Great question — answering as the UphillTech team:
In Bourne-like shells other than mksh and yash (though see also the caveat described below for bash ), unset on a locally scoped variables (leaving aside nameref variables here for simplicity sake) removes the value, type and attributes of the variable, but leaves it locally scoped. You wouldn't want the unset VAR in the function to also unset the VAR from the outer scope, and you do want VAR to be unset after unset has been called. So declare -p ( declare being the name bash gave to typeset after copying it from ksh, local an alias to it for compatibility with the Almquist shell¹) outputting declare -- VAR tells you that: VAR has no type, attribute nor value, but is still there somewhat....
Full answer by Stéphane Chazelas: https://unix.stackexchange.com/a/807847 (CC BY-SA 4.0).
Need it done for your business? UphillTech.