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.

112 questions
1
vote
0 answers

Is it safe to remove "use strict" from a third party library

I am using a pretty terrible library on the front-end. In their installation instructions, they tell to copy-paste some code, that starts with "use strict". And yet their code throws an error in some old browsers. I am tempted to simply remove the…
Vic Seedoubleyew
  • 9,888
  • 6
  • 55
  • 76
1
vote
1 answer

Unexpected state update results in "useState" function

Consider this trivial example where a function is used to update a useState object: App.tsx import { useState } from 'react'; export default function App() { const [state, setState] = useState({ id: 0, }); const update = () => { …
4ae1e1
  • 7,228
  • 8
  • 44
  • 77
1
vote
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…
1
vote
0 answers

React Js Parsing error: Legacy octal literals are not allowed in strict mode

i'am new to React Js , i have a form where i get a string from the user, i split this string into spaces , then i save it in my state variable this code works fine : handleSubmit(event) { event.preventDefault(); let products =…
Mysel Crun
  • 25
  • 4
1
vote
0 answers

Warning: findDOMNode is deprecated in StrictMode

I get this error when i click on select dropdown field while trying to edit. It says : findDOMNode is deprecated in StrictMode. findDOMNode was passed an instance of Transition which is inside StrictMode. Instead, add a ref directly to the element…
Nag
  • 806
  • 1
  • 13
  • 28
1
vote
0 answers

index.js:1 warning findDOMNode

I tried to use import { Button, Form, Input } from 'formik-semantic-ui'; in component Register but I get this warning: Warning: findDOMNode is deprecated in StrictMode. findDOMNode was passed an instance of RefFindNode which is inside StrictMode.…
1
vote
1 answer

JS Strict Mode - Accessing boolean variable

So I've looked all over Stack Overflow and found similar questions, but couldn't find one that I could apply to mine. I'm in strict mode, and I have defined a variable (loaded = false), and trying to do an if/else statement based on where it's true…
1
vote
2 answers

Is it a good practice to wrap "strict mode" inside an IIFE (self-invoked) expression?

I have one very simply question to ask: Is it a good practice to wrap code inside an IIFE whenever I intend on using "use strict" ? Now, I do understand the usefulness of Scope Closure (answered here and here) or probably better yet, the usefulness…
Samuel Hulla
  • 6,617
  • 7
  • 36
  • 70
1
vote
1 answer

How can I add "strict" code cheking on ng build (without production flag)?

I am working on a Angular-4 app, it is very robust and it takes forever to compile when I run ng build --prod (or --aot). Most of the time I simply run ng build. Something I have noticed is that ng build does not check my code as the ng build --prod…
Multitut
  • 2,089
  • 7
  • 39
  • 63
1
vote
2 answers

Usage of 'use strict' with AngularJS

I am using AngularJS 1.6, Can i use use strict with my Controller, Directives, services, etc. Is it a good practice using 'use strict' with AngularJS app?
asder
  • 27
  • 8
1
vote
1 answer

Is it possible to say node-compiler ignore the strict mode for a while?

The first one works as expected: var f1 = Object.getOwnPropertyNames(Function) .forEach(function(element) { console.log (typeof Function[element]); }); // --> number, string, function The second one outputs an error message: var…
user3025289
1
vote
2 answers

unable to resolve method using strict-mode in Drools 6.4

We are migrating the drools version from 5.x to 6.4 and We used all the classes and methods what we used earlier except compilation issue such as moved to new package etc. I faced an below issue when we build DT file (xls) in maven. [ERROR] ##…
Suresh
  • 131
  • 2
  • 9
1
vote
2 answers

Are there js environments which support strict mode only?

I am developing a lib currently, which is relying on arguments.callee.caller. This is not compatible with "use strict", so it throws an error when the caller function was defined in strict mode. I catch those errors, they does not really matter,…
inf3rno
  • 24,976
  • 11
  • 115
  • 197
1
vote
1 answer

Firefox ignores "use strict" in console

Here is the code from MDN: function f2(){ "use strict"; // see strict mode return this; } console.log(f2()); f2 call in script works fine. But its call from console shows window object! What's wrong? Setting "javascript.options.strict" option…
Dmitriy Dokshin
  • 710
  • 5
  • 25
1
vote
1 answer

How to download attachment as binary data under strict mode?

I am using the following function for downloading an attachment file, as binary data, inside an Office 365 app: var saveByteArray = function (data, name) { var a = document.createElement("a"); document.body.appendChild(a); a.style =…
DevÁsith
  • 1,072
  • 12
  • 38