Describe different types and uses of JavaScript modules. Which JavaScript modules are suited for which tasks?

  • This is a question for the certification study guide.
  • I know it's kind broad, but still there is no direct answer on this in the docs.

This is what I found in the Swift Otter guide.

Magento 2 utilizes RequireJS to create a modular and extensible system in JavaScript. Javascript modules can be completely custom, can extend a UI Component module, or be a jQuery widget. They can be asynchronously loaded or embedded directly in a page using a plain tag. Magento’s allows for loading modules and passing even complex configuration info into them. These modules handle much interaction between the website user and the Magento PHP application. Using Javascript to load aspects of customer data is ideal because it allows Magento to cache the full page. You can keep all blocks cacheable and load in the customer-specific information in an AJAX request. For work with grids and forms in the admin panel or the checkout, a UI Component Javascript module would be a good approach. For using KnockoutJS for a customer area, a simple module that is initialized through would work well. For handling smaller DOM manipulation tasks, a module that creates a jQuery widget would be good.

I would say that the Javascript Module types are ui components, jquery widgets and plain javascript components.

Any opinions, hints, resources (I looked through the docs, in my opinion the JS part skips on the fundamentals)

  • Wow that is broad. So many ways in which you could read that. I'd even go as far to say that the answer to this would be based on opinion not fact. Tough questions to get certified! May 25, 2019 at 21:49

1 Answer 1


Not a great answer this but I've got my magento 2 hat on and I'm thinking when they wrote these questions they were sifting through the developer docs. I think they mean declarative notation and imperative notation


But it's an absolute guess. As to suited to which task. I'm not sure. Even as I'm typing this I have doubts about my answer.

Good luck!

In response to your comment here you go.



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.