Why does JSHint throw a warning if I am using const?

This is the error I get when using const: <error line=”2″ column=”1″ severity=”warning” message=”&apos;const&apos; is available in ES6 (use esnext option) or Mozilla JS extensions (use moz).” source=”jshint.W104″ /> My code looks like this: const Suites = { Spade: 1, Heart: 2, Diamond: 3, Club: 4 }; The code works fine only JSHint is warning … Read more

Why avoid increment (“++”) and decrement (“–“) operators in JavaScript?

One of the tips for jslint tool is: ++ and — The ++ (increment) and — (decrement) operators have been known to contribute to bad code by encouraging excessive trickiness. They are second only to faulty architecture in enabling to viruses and other security menaces. There is a plusplus option that prohibits the use of … Read more

Should I use JSLint or JSHint JavaScript validation? [closed]

Closed. This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 2 years ago. Improve this question I am currently validating my JavaScript against JSLint and making progress on, it’s assisting me to … Read more

JSLint says “missing radix parameter”

I ran JSLint on this JavaScript code and it said: Problem at line 32 character 30: Missing radix parameter. This is the code in question: imageIndex = parseInt(id.substring(id.length – 1))-1; What is wrong here? 1Best Answer 11 It always a good practice to pass radix with parseInt – parseInt(string, radix) For decimal – parseInt(id.substring(id.length – … Read more

JSLint is suddenly reporting: Use the function form of “use strict”

I include the statement: “use strict”; at the beginning of most of my Javascript files. JSLint has never before warned about this. But now it is, saying: Use the function form of “use strict”. Does anyone know what the “function form” would be? 9 s 9 Include ‘use strict’; as the first statement in a … Read more

What does “use strict” do in JavaScript, and what is the reasoning behind it?

Recently, I ran some of my JavaScript code through Crockford’s JSLint, and it gave the following error: Problem at line 1 character 1: Missing “use strict” statement. Doing some searching, I realized that some people add “use strict”; into their JavaScript code. Once I added the statement, the error stopped appearing. Unfortunately, Google did not … Read more