How should I mark a method as "obsolete" in JS?
There are a couple of things you can do in a transition period.
- Add the
@deprecated
JSDoc flag. - Add a console warning message that indicates that the function is deprecated.
A sample:
/**
* @deprecated Since version 1.0. Will be deleted in version 3.0. Use bar instead.
*/
function foo() {
console.warn("Calling deprecated function!");
bar();
}