Uncaught SyntaxError: In strict mode code, functions can only be declared at top level or immediately within another function
It's just what the error message says:
functions can only be declared at top level or immediately within another function
You must not put a function declaration inside any other block, like an if-statement or for-loop.
Example:
'use strict';
function some() {
function okay() {
}
let x = 1;
function no_problem() {
}
if (x == 1) {
function BOOM() { // <- wrong!
}
}
}
As someone suggested above, you can uncomment the 'use strict';
part, or even better, change your function syntax
instead of
function funcName (param) { }
use
funcName = function(param) {};
The way I solved the problem was by removing the 'use strict'
that was above the jquery in the final minified script. Another way can be changing the jQuery version to one without the strict bug
EDIT: After all it was a jQuery minification error on version 1.11, and an easy fix for this is to go to your Grunt file and comment out the line
banner: "'use strict';\n"