What is the difference between define
and require
, and when should I use each of them? I have read different answers on Stack Overflow, but I still haven't been able to understand.
For example, if this was on main.js
(config file require points to), what is the difference?
define(["jquery"], function($) {
do something with $
});
require(["jquery"], function($) {
do something with $
});
Is $/jQ
guaranteed to be loaded and ready in both?