Linked Questions

1178 votes
33 answers
520k views

Is there a way to use constants in JavaScript? If not, what's the common practice for specifying variables that are used as constants?
fuentesjr's user avatar
  • 52.5k
597 votes
13 answers
123k views

In another question, a user pointed out that the new keyword was dangerous to use and proposed a solution to object creation that did not use new. I didn't believe that was true, mostly because I've ...
Pablo Fernandez's user avatar
648 votes
10 answers
127k views

I have been reading a lot of Javascript lately and I have been noticing that the whole file is wrapped like the following in the .js files to be imported. (function() { ... code ... })();...
Andrew Kou's user avatar
  • 7,155
148 votes
10 answers
80k views

I've been looking over the JavaScript reference on the Mozilla Developer Network, and I came across something called "strict mode". I read it over and I'm having trouble understanding what ...
nkcmr's user avatar
  • 11.1k
178 votes
2 answers
77k views

I've seen posts regarding where to put the "use strict" line in a TypeScript code file. My question is, why have it at all? Since TypeScript is already a strongly typed language, what does "use ...
DeborahK's user avatar
  • 60.9k
57 votes
8 answers
179k views

I'm trying to start playing an embedded youtube video by clicking an image. The idea is to have an image on top of a video, and when the image is clicked it fades out and starts playing the video. I'...
Corn's user avatar
  • 571
134 votes
1 answer
7k views

Following the question Extending String.prototype performance I am really intrigued, because just adding "use strict" to a String.prototype method improved performance 10 times. The explanation by ...
exebook's user avatar
  • 34.5k
63 votes
6 answers
7k views

I spent hours just to find out that I misspelt the word .length as .lenght. It can run normally with no warning at all. Why...? I use 'use strict' and run on Node.js 10.13.0. Code: 'use strict';...
MangoLato's user avatar
  • 662
89 votes
3 answers
71k views

I don't find anything about my question here on MDC or the ECMAscript specifications. Probably somebody knows a more 'hacky' way to solve this. I'm calling "use strict" on every javascript file in my ...
jAndy's user avatar
  • 237k
37 votes
5 answers
20k views

I've found this post-What does "use strict" do in JavaScript, and what is the reasoning behind it? And what I'm understanding here is that I should use strict always. But I wonder, if it ...
Ramon Marques's user avatar
43 votes
4 answers
9k views

What scope does the strict mode pragma have in ECMAScript5? "use strict"; I'd like to do this (mainly because JSLint doesn't complain about it): "use strict"; (function () { // my stuff here... }(...
Stephen Sorensen's user avatar
21 votes
2 answers
4k views

I have read Crockford's JavaScript: The Good Parts and have used his validator JSLint. I am sometimes left wondering the justification behind his recommendations. Below is a list of examples I want ...
19 votes
3 answers
5k views

I never knew use strict to speed up runtime, however a simple use strict is making my benchmark substantially faster, and the slower one grossly slower (over twice as slow). What's going on? // // ...
Evan Carroll's user avatar
18 votes
2 answers
11k views

Just curious whether there are any drawbacks to including: "compilerOptions": { "alwaysStrict": true, ... } Since it's false by default. Thoughts?
Ole's user avatar
  • 48.2k
28 votes
1 answer
14k views

https://developer.mozilla.org/en-US/docs/Web/API/GlobalEventHandlers.onerror states: Note that some/many error events do not trigger window.onerror, you have to listen for them specifically. Could ...
Lone Learner's user avatar
  • 21.2k

15 30 50 per page
1
2
3 4 5
8