I assume the docs mean to say "here is an example of the proper usage" rather than "problem use", unless I'm mistaken?
https://deploy-preview-38018--twbs-bootstrap.netlify.app/docs/5.3/getting-started/javascript/#dispose-method