Const { inject } = Ember; Can somebody explain what this does?

I had gotten a jshint error saying that inject was defined but never used. Can somebody explain to me what exactly const { inject } = Ember; does? More specifically in the adapters/application.js file. Sorry if this question is pointless or whatever, I’m just starting to learn.

That’s called object destructuring.

It’s aliasing inject to Ember.inject. You might be familiar with writing something similar like: const inject = Ember.inject;

1 Like