Questions tagged [strict-mode]

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.

93 questions
4
votes
3 answers

Vue.js - Dynamic inputs breaking in IE11

I'm getting an error when trying to create a dynamic input in Vue when attempting to view my app in IE. The page doesn't load and I get a "Multiple definitions of a property not allowed in strict mode." The input has both a v-model and :value…
4
votes
2 answers

Changing the type of a variable in strict mode

Whilst taking a quiz on PluralSight about JavaScript, I came across this question: Assuming you've enabled strictness, can you change the type of a variable once defined? Yes, without restriction Yes, but you have to redefine the variable No The…
noggin182
  • 627
  • 3
  • 14
4
votes
1 answer

How to enable strict mode for my whole package but not for dependency?

I used to write "use strict"; as first line in my JavaScript files to enable the strict mode. Now I don't want to add this as boilerplate code to over 200 JavaScript files of my current NodeJs package. Is there any way to force strict mode for all…
Sebastian Barth
  • 3,217
  • 5
  • 32
  • 48
4
votes
1 answer

Call overloaded method from Drools: `unable to resolve method using strict-mode`

I'm newbie with java and drools and I have to build a java RESTful Web Services / rules engine. We already have Genesys Rule Authoring (GRAT) and Genesys Rule Engine (GRE) (version 8.1.2) who run drools version 5.2. We have the need to take the…
Alain Tanguay
  • 43
  • 1
  • 2
  • 5
3
votes
1 answer

Defining "eval" as a formal parameter of a Function constructor invocation. Shouldn't that throw a syntax error in strict mode code?

The specification states: It is a SyntaxError to use within strict mode code the identifiers eval or arguments as the Identifier of a FunctionDeclaration or FunctionExpression or as a formal parameter name (13.1). Attempting to dynamically…
Šime Vidas
  • 163,768
  • 59
  • 261
  • 366
3
votes
2 answers

Determine MySql mode from PHP

Is there any way to find if mysql server is in strict mode or not from PHP? I need to find out this at runtime(in installation script), so I can inform user if his system satisfy script requirements.
Ivica
  • 795
  • 2
  • 8
  • 19
3
votes
1 answer

react-draft-wysiwyg - Warning: Can't call setState

I did make a simple react app with react-draft-wysiwyg, but I get a warning. import React from "react"; import ReactDOM from "react-dom"; import { Editor } from "react-draft-wysiwyg"; import…
3
votes
2 answers

Retrieve "self" function in the strict-mode JavaScript

I often need in a function f to retrieve a name of the method that points to f. For example. Let's say we have a getMethodName(obj, methodFunction) function that uses foreach on obj to find a property that is a link to methodFunction: obj = { …
tillda
  • 16,950
  • 16
  • 48
  • 69
3
votes
1 answer

How can [this] be undefined in strict mode?

When I run this code in Chrome, I get an Uncaught TypeError: Cannot read property 'concat' of undefined function _log() { 'use strict' [this].concat(Array.from(arguments)).forEach( function (obj) { console.log(obj) } …
Lynn
  • 383
  • 3
  • 9
3
votes
2 answers

Why does strict mode make such simple actions such different?

There is an extremely simple algorythm, which works surprisely different in two cases, depending on the presence of "use strict". Case 1: If func() declaration is within the strict mode, than console logs primitive "use strict"; // strict mode is…
Dima Parzhitsky
  • 3,716
  • 2
  • 20
  • 37
3
votes
1 answer

Dynamic parameter accessing default value

I have a PowerShell function that takes an optional parameter, validated using a ValidateSetAttribute, and based on that value it adds another dynamic parameter. However, in strict mode, when trying to access the parameter inside of the DynamicParam…
poke
  • 307,619
  • 61
  • 472
  • 533
2
votes
2 answers

Must we pay attention to JavaScript "strict mode"?

Reading about ECMAScript 5's strict mode I learn that: Certain language functions are so pervasive that performing runtime checks has considerable performance cost. A few strict mode tweaks, plus requiring that user-submitted JavaScript be…
Igor Parra
  • 9,600
  • 10
  • 66
  • 93
2
votes
0 answers

Inquiry on findDOMNode is deprecated in StrictMode

I am new to React and I recently encountered this warning: findDOMNode is deprecated in StrictMode. findDOMNode was passed an instance of Transition which is inside StrictMode. Instead, add a ref directly to the element you want to reference. Turns…
2
votes
0 answers

Why doesn't Strict Mode throw Syntax Error on duplicated property names?

In JavaScript, Strict Mode is supposed to throw Syntax Error if we try to define object with duplicated properties, like this: const foo = {a: 1, a: 2}; Call me crazy, but I remember it did. Today I was in shock to find out that it doesn't at least…
Robo Robok
  • 15,554
  • 12
  • 46
  • 87
2
votes
0 answers

I need help understanding JavaScript "strict mode"

I'm writing a lot more JavaScript these days than I used to. I'm writing a bunch of JavaScript libraries for our product. Wanting to be as careful as possible I'm doing full jsdoc comments, etc. I also have 'use strict'; in all of my libraries and…
Scott Gartner
  • 704
  • 9
  • 20