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
1
vote
1 answer

Do I need to use the function form of 'use strict' in jasmine test files?

I'm building unit tests in jasmine based on examples I've seen with AngularJS. The examples, such as this unit test in the Angular PhoneCat tutorial, use the global form of 'use strict'. However, JSHint complains that I should Use the function form…
drs
  • 5,679
  • 4
  • 42
  • 67
1
vote
4 answers

How to get rid of use-strict warning when using webpack and jshint-loader?

I have a webpack project wired with the jshint-loader which is defined like so: postLoaders: [ { test: /\.js$/, exclude: /node_modules/, loader: 'jshint-loader' } ], and when I run webpack-dev-server I…
Yoni Dabush
  • 220
  • 4
  • 13
1
vote
0 answers

JSHint Function Is Not Defined

I am trying to write better Javascript / JQuery code and I set up JSHint with my Grunt. Now I have gone though my code and its seems to be ok, without using 'strict'. I have split my code into many files, admin section, lib section (for my JQuery,…
user4458505
  • 217
  • 1
  • 6
  • 12
1
vote
0 answers

Why does JSHint show missing 'use strict' error at end of self invoking function with parameters

jsHint generates an error at the end of a self invoking function using the standard Module Pattern where I pass in parameters: }(window.document, jQuery)) Anyone know why? var kaApp = (function (document, $) { 'use strict'; var testStrict =…
cmorrow
  • 556
  • 6
  • 9
1
vote
1 answer

difference between symbolic reference and hard reference in perl

I have been using hard reference in perl. But was thinking in what way symbolic reference can be helpful to programmers. no strict "ref";
made_in_india
  • 2,109
  • 5
  • 40
  • 63
1
vote
1 answer

JSLint, disable rules globally

If I've install JSLint through NPM globally, is there a way to disable certain rules either within the current scope of my application or globally on my system? The main issue is the dangling underscore problem. I mean, the main place this comes up…
Parris
  • 17,833
  • 17
  • 90
  • 133
0
votes
1 answer

JavaScript: duplicate property name and getter/setter an error in ES5?

JS noob here: If a getter/setter with a particular name is used that is the same as a property's name that takes on a value, and in code that is in strict mode, will an error occur in ES5? Ex (where yes, I know I am not properly using the getter and…
0
votes
1 answer

Why does this code create the object, but still treats it as undefined?

I don't understand why doesn't this code work as expected: "use strict"; window.obj.prop = (() => { window.obj = { myobj: true }; return "value"; })(); I always thought that = operator first evaluates whatever it is to the right of it…
Parzh from Ukraine
  • 7,999
  • 3
  • 34
  • 65
0
votes
1 answer

Why isn't "use strict" default?

Why isn't "use strict" the default way to interpret ES6 javascript, preferring the functionality: "do not use strict" (or whatever) to turn it off? Previously, I imagined "use strict" as sort of like Safe Mode in macOS (only to be turned on when…
PJM Design
  • 150
  • 5
0
votes
0 answers

Not-enabled 'use strict' is blocking execution of the code

Yesterday, I was practicing just a real basics and everything worked fine. But when I opened test html today, I noticed that there are the error now: const otherDate = new Date(); document.getElementById('demo2').innerHTML …
0
votes
2 answers

WebStorm on Ubuntu issue

A few days ago I installed Ubuntu on my computer and then WebStorm but I'm having an issue with JavaScript projects. It gave me an error saying that I cannot use the word "let". After a few hours, I found some solutions: by using "use strict". Is it…
0
votes
1 answer

Meteor won't start. "Block-scoped declarations (let, const, function, class) not yet supported outside strict mode" in ejson.js

I'm new to Meteor, and only trying to install and get a new app running. I had things were working last Friday, but had to reinstall today and can no longer get the app running. The install has been a challenge. Trying to install on Windows, and…
03T
  • 49
  • 1
  • 10
0
votes
0 answers

"use strict" issue in Edge browser from angular 4

I am having trouble to resolve this issue which appears in Edge browser. Have tried manually removing "use strict" from my build, which did not help me out. I am using the latest angular 4.3.6 in my application. ERROR TypeError: Assignment to…
Karthik
  • 39
  • 7
0
votes
1 answer

Use strict mode on Progress bar

Progress bar is working If I put it directly in the index.html page. But it isn't working (animation) if I put it in external active.js file with "use strict" mode. But Other JS is working fine. Please Help me. Thanks in advance. Here is my code…
Ziaul
  • 13
  • 4
0
votes
1 answer

use strict leads to undefined function

I am trying to organize my js file and followed a suggested module pattern. When I use "use-strict" in this pattern a function is declared as undefined, without the "use-strict" method the function just works fine. Is the strict-mode recommended and…
user5991491