Questions tagged [use-strict]

According to Mozilla Developer Network, ECMAScript 5's strict mode is a way to opt in to a restricted variant of JavaScript. Strict mode isn't just a subset: it intentionally has different semantics from normal code.

According to Mozilla Developer Network, ECMAScript 5's strict mode is a way to opt in to a restricted variant of JavaScript. Strict mode isn't just a subset: it intentionally has different semantics from normal code.

100 questions
0
votes
0 answers

Why "use strict"; prevent a jQuery click event on Safari?

My jQuery click event does not work when I use the "strict mode" in my external javascript file. The "use strict"; is placed on top of the file. However, the click event does works when using the script in the head of the file. The version of safari…
Mike Casan Ballester
  • 1,690
  • 19
  • 33
0
votes
0 answers

What happens if I don't put "use strict" in a function?

What's the difference following two cases? Using use strict at the top of the file, not in a function "use strict"; (function () { // ... })(); Using use strict in the wrapping function (function () { "use strict"; // ... })(); I read in a…
Ionică Bizău
  • 109,027
  • 88
  • 289
  • 474
0
votes
2 answers

'use-strict' enabled but not working in node

I have enabled use-strict mode in my .js file but when I run it, node keeps telling me that I don't have it enabled. PLEASE don't tell me to write "use-strict"; at the top of my file because I already tried that. Here is my server.js file. I have…
ChannelJuanNews
  • 406
  • 3
  • 11
0
votes
1 answer

Can a function be called using string value in strict mode

I was wondering if it's possible to call a function by passing a string name. Following is the basic architecture: Javascript: "use strict"; function foo(){ var f = this; f.fn = function(o){return fn(o)} function fn(o){ o.name(); …
rex
  • 985
  • 5
  • 28
  • 48
0
votes
2 answers

function foo(param) { alert("foo called"); } and $scope.foo = function(param){alert("foo");};

I think I am having a similar problem with AngularJS like many others. I was fixing a previous error message (that I could not call controller functions from within test describe blocks) and got new errors. Error: [ng:areq] Argument…
0
votes
2 answers

How to use "use strict" without modifying the scope of my utilities objects?

I'm using several global utilities objects such as: var StringUtils = { // ... equalsIgnoreCase: function(string1, string2) { return string1.toUpperCase() === string2.toUpperCase(); } // ... }; How to use "use strict" in…
sp00m
  • 47,968
  • 31
  • 142
  • 252
0
votes
1 answer

"use strict;" line in perl causing a simple print script to fail to run

I installed apache and perl a few days ago and have been successful in running a few scripts, but I have not been able to get a single script to run after putting the "use strict;" line in. All I see upon adding that line is a very generic "Internal…
0
votes
1 answer

Uncaught SyntaxError: Unexpected token ILLEGAL after code passes jslint "use strict" check okay

I have the following code from my team mate /*jslint browser: true*/ /*jslint vars: true */ /*global $, jQuery*/ /*global dialog*/ function accessControls() { "use strict"; $('#loginLink, #registerLink').click(function (e) { …
Samantha J T Star
  • 30,952
  • 84
  • 245
  • 427
0
votes
2 answers

Web browser is being "strict" for operations on undefined variables in Javascript

If the variable foo is undefined, normally I can do things like: !foo; foo === undefined; foo !== 'some value'; However, the code base that I am working on now has something in it that seems to instruct the browser's interpreter to throw an…
Chris Dutrow
  • 48,402
  • 65
  • 188
  • 258
-1
votes
1 answer

How to use undeclared variables in Reactjs

I am creating a script node in my react code on run time using document.createElement('script') and assigning its src to a url, Now I want to use the variable of the included JS in my react code without declaring it.
1 2 3 4 5 6
7