How about
```javascript
tasks.forEach(function(task) {
	if (task.split('.').pop() !== 'js') return;
	require('./tasks/' + task);
});
```