javascriptfunctionrequirejs-define

What is define([ , function ]) in JavaScript?


I see this being used all the time in JavaScript:

define(['param1', 'param2'], function() {

});

What is the define function?


Solution

  • define() is part of the AMD spec of js

    See:

    Edit: Also see @Claudio Redi's answer. Likely the more relevant explanation.