Skip to main content
AI Assist is now on Stack Overflow. Start a chat to get instant answers from across the network. Sign up to save and share your chats.
deleted 42 characters in body; edited title
Source Link
user633440
user633440

Uncaught ReferenceError: forEach is not defined when adding jsJS to app.js in laravel, works fine in isolationLaravel

I have some browser sniffer code, using the function detect.jsdetect.js. It works fine when not added to my project. Still, but when I try to compile the jsJavaScript and addingadd it to app.js, I get an error in the console Uncaught ReferenceError: forEach is not defined at thisthe first line below, when refreshing the browser and attempt to detectdetecting the browser version.

Uncaught ReferenceError: forEach is not defined.

// Each Utility var each = forEach = function (obj, iterator, context) { if (obj == null) return; if (nativeForEach && obj.forEach === nativeForEach) { obj.forEach(iterator, context); } else if (obj.length === +obj.length) { for (var i = 0, l = obj.length; i < l; i++) { iterator.call(context, obj[i], i, obj); } } else { for (var key in obj) { if (_.has(obj, key)) { iterator.call(context, obj[key], key, obj); } } } }; 

https://github.com/darcyclarke/Detect.js/blob/master/detect.js

It seems like compiling the javascriptJavaScript is doing something to it. Any suggestions?

Uncaught ReferenceError: forEach is not defined when adding js to app.js in laravel, works fine in isolation

I have some browser sniffer code, using the function detect.js. It works fine when not added to my project, but when I try to compile the js and adding it to app.js I get an error in the console Uncaught ReferenceError: forEach is not defined at this first line below, when refreshing the browser and attempt to detect the browser version.

Uncaught ReferenceError: forEach is not defined.

// Each Utility var each = forEach = function (obj, iterator, context) { if (obj == null) return; if (nativeForEach && obj.forEach === nativeForEach) { obj.forEach(iterator, context); } else if (obj.length === +obj.length) { for (var i = 0, l = obj.length; i < l; i++) { iterator.call(context, obj[i], i, obj); } } else { for (var key in obj) { if (_.has(obj, key)) { iterator.call(context, obj[key], key, obj); } } } }; 

https://github.com/darcyclarke/Detect.js/blob/master/detect.js

It seems like compiling the javascript is doing something to it. Any suggestions?

Uncaught ReferenceError when adding JS to app.js in Laravel

I have some browser sniffer code using the function detect.js. It works fine when not added to my project. Still, when I try to compile the JavaScript and add it to app.js, I get an error in the console at the first line below, refreshing the browser and detecting the browser version.

Uncaught ReferenceError: forEach is not defined.

// Each Utility var each = forEach = function (obj, iterator, context) { if (obj == null) return; if (nativeForEach && obj.forEach === nativeForEach) { obj.forEach(iterator, context); } else if (obj.length === +obj.length) { for (var i = 0, l = obj.length; i < l; i++) { iterator.call(context, obj[i], i, obj); } } else { for (var key in obj) { if (_.has(obj, key)) { iterator.call(context, obj[key], key, obj); } } } }; 

It seems like compiling the JavaScript is doing something to it. Any suggestions?

edited tags
Source Link
user633440
user633440

I have some browser sniffer code, using the function detect.js. It works fine when not added to my project, but when I try to compile the js and adding it to app.js I get an error in the console Uncaught ReferenceError: forEach is not defined at this first line below, when refreshing the browser and attempt to detect the browser version.

Uncaught ReferenceError: forEach is not defined.

 // Each Utility  var each = forEach = function (obj, iterator, context) {   if (obj == null) return;   if (nativeForEach && obj.forEach === nativeForEach) {   obj.forEach(iterator, context);   } else if (obj.length === +obj.length) {   for (var i = 0, l = obj.length; i < l; i++) {   iterator.call(context, obj[i], i, obj);   }   } else {   for (var key in obj) {   if (_.has(obj, key)) { iterator.call(context, obj[key], key, obj);   }   }   }  }; 

https://github.com/darcyclarke/Detect.js/blob/master/detect.js

It seems like compiling the javascript is doing something to it. Any suggestions?

I have some browser sniffer code, using the function detect.js. It works fine when not added to my project, but when I try to compile the js and adding it to app.js I get an error in the console Uncaught ReferenceError: forEach is not defined at this first line below, when refreshing the browser and attempt to detect the browser version.

 // Each Utility  var each = forEach = function(obj, iterator, context) {   if (obj == null) return;   if (nativeForEach && obj.forEach === nativeForEach) {   obj.forEach(iterator, context);   } else if (obj.length === +obj.length) {   for (var i = 0, l = obj.length; i < l; i++) {   iterator.call(context, obj[i], i, obj);   }   } else {   for (var key in obj) {   if (_.has(obj, key)) { iterator.call(context, obj[key], key, obj);   }   }   }  }; 

https://github.com/darcyclarke/Detect.js/blob/master/detect.js

It seems like compiling the javascript is doing something to it. Any suggestions?

I have some browser sniffer code, using the function detect.js. It works fine when not added to my project, but when I try to compile the js and adding it to app.js I get an error in the console Uncaught ReferenceError: forEach is not defined at this first line below, when refreshing the browser and attempt to detect the browser version.

Uncaught ReferenceError: forEach is not defined.

// Each Utility var each = forEach = function (obj, iterator, context) { if (obj == null) return; if (nativeForEach && obj.forEach === nativeForEach) { obj.forEach(iterator, context); } else if (obj.length === +obj.length) { for (var i = 0, l = obj.length; i < l; i++) { iterator.call(context, obj[i], i, obj); } } else { for (var key in obj) { if (_.has(obj, key)) { iterator.call(context, obj[key], key, obj); } } } }; 

https://github.com/darcyclarke/Detect.js/blob/master/detect.js

It seems like compiling the javascript is doing something to it. Any suggestions?

Fix closing code block code
Source Link
shaedrich
  • 5.8k
  • 3
  • 31
  • 47

I have some browser sniffer code, using the function detect.js. It works fine when not added to my project, but when I try to compile the js and adding it to app.js I get an error in the console Uncaught ReferenceError: forEach is not defined at this first line below, when refreshing the browser and attempt to detect the browser version.

 // Each Utility var each = forEach = function(obj, iterator, context) { if (obj == null) return; if (nativeForEach && obj.forEach === nativeForEach) { obj.forEach(iterator, context); } else if (obj.length === +obj.length) { for (var i = 0, l = obj.length; i < l; i++) { iterator.call(context, obj[i], i, obj); } } else { for (var key in obj) { if (_.has(obj, key)) { iterator.call(context, obj[key], key, obj); } } } };   https://github.com/darcyclarke/Detect.js/blob/master/detect.js It seems like compiling the javascript is doing something to it. Any suggestions? 

https://github.com/darcyclarke/Detect.js/blob/master/detect.js

It seems like compiling the javascript is doing something to it. Any suggestions?

I have some browser sniffer code, using the function detect.js. It works fine when not added to my project, but when I try to compile the js and adding it to app.js I get an error in the console Uncaught ReferenceError: forEach is not defined at this first line below, when refreshing the browser and attempt to detect the browser version.

 // Each Utility var each = forEach = function(obj, iterator, context) { if (obj == null) return; if (nativeForEach && obj.forEach === nativeForEach) { obj.forEach(iterator, context); } else if (obj.length === +obj.length) { for (var i = 0, l = obj.length; i < l; i++) { iterator.call(context, obj[i], i, obj); } } else { for (var key in obj) { if (_.has(obj, key)) { iterator.call(context, obj[key], key, obj); } } } };   https://github.com/darcyclarke/Detect.js/blob/master/detect.js It seems like compiling the javascript is doing something to it. Any suggestions? 

I have some browser sniffer code, using the function detect.js. It works fine when not added to my project, but when I try to compile the js and adding it to app.js I get an error in the console Uncaught ReferenceError: forEach is not defined at this first line below, when refreshing the browser and attempt to detect the browser version.

 // Each Utility var each = forEach = function(obj, iterator, context) { if (obj == null) return; if (nativeForEach && obj.forEach === nativeForEach) { obj.forEach(iterator, context); } else if (obj.length === +obj.length) { for (var i = 0, l = obj.length; i < l; i++) { iterator.call(context, obj[i], i, obj); } } else { for (var key in obj) { if (_.has(obj, key)) { iterator.call(context, obj[key], key, obj); } } } }; 

https://github.com/darcyclarke/Detect.js/blob/master/detect.js

It seems like compiling the javascript is doing something to it. Any suggestions?

Source Link
GAV
  • 1.2k
  • 3
  • 19
  • 40
Loading