Question

The yepnope.js provides its useful API: yepnope. It accepts a single object or an array as its parameter.

But are

yepnope({
  load: 'a.js',
  complete: function() {
    console.log("loaded a.js");
  },
});

yepnope({
  load: 'b.js',
  complete: function() {
    console.log("loaded b.js");
  },
});

and

yepnope([
{
  load: 'a.js',
  complete: function() {
    console.log("loaded a.js");
  },
},
{
  load: 'b.js',
  complete: function() {
    console.log("loaded b.js");
  },
}
]);

equivalent? If not, which is better?

Was it helpful?

Solution

Functionally, I don't think there's a difference. It's up to your style, the situation, and how the rest of the application is written.

When these two examples are run in Chrome, the developer tools show just about the same page load times. On average, it looks like the first example is a few milliseconds faster. But sometimes it can be slower, too.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top