They can be useful if you're working in situations where preserving and using the correct form of _this_ is necessary. Could be a situation with funky legacy code or writing library/utility functions (like an implementation of debounce) where you can't be certain of the context in which your function is going to be used.
These don't come up a ton in modern code bases in part because of the advent of arrow functions, and in part because of the general trend towards FP / declarative programming in JS/TS and away from OOP / "class" use and thus less need for managing "this" throughout an application. Also most of the time if you really need a utility function it's easier to rely on a bulletproof dependency library like Ramda/Lodash/Underscore... concerns about bundle size notwithstanding.
Another use case is if you need to use array methods on array-like things (this comes up sometimes with DOM manipulation). These data structures are iterables but lack the native array methods like map/filter/reduce etc. If for some reason you can't/don't want to create a new array from your data structure to operate on you can do something like Array.prototype.filter.call(myNodeList, filterFunction). Also not terribly common in modern codebases, but useful to be aware of!
apply could be useful before the spread operator existed.
They can also be a bit useful to call one prototype’s function on another object given you get to pick what “this” is.
But in my 12 years I’ve never used them. They’re likely even less important now that we have arrow functions and other features. They probably were useful library building blocks way back in the day.
>Rather, who precisely wants a recession now, in your opinion?
I don't think you need more than one guess to figure out the average political leaning of most CEOs and Chairs of corporate boards and then combine that with who is the incumbent
The BBC is pushing its Sounds app by lagging the podcast. Disappointing but understandable I guess given they want the opportunity to suggest other programmes.
the Paris Review often prints draft versions of significant stories, poems, essays, etc. with editorial notes and marginalia on them. It really helps to see how these things weren't always in their final state.
reply