'url' is never reassigned. Use 'const' instead
122 }
123 }
124
125 let url = "/client/" + input.value + "/cpf-cnpj";126 $.get(url, function(data){
127 if (data === "True") {
128 $("#cpfCnpj").addClass("is-invalid");
'url' is never reassigned. Use 'const' instead
28 * @param input - The input element that is being validated.
29 */
30function validateEmail(input) {
31 let url = "/user/" + input.value + "/email"; 32 $.get(url, function(data){
33 if (data === "True") {
34 $("#email").addClass("is-invalid");
'url' is never reassigned. Use 'const' instead
6 * @param input - The input element that is being validated.
7 */
8function validateLogin(input) {
9 let url = "/user/" + input.value + "/login"; 10 $.get(url, function(data){
11 if (data === "True") {
12 $("#username").addClass("is-invalid");
'url' is never reassigned. Use 'const' instead
2$("#zip_code").change(function() {
3 let zip_code = $(this).val();
4 zip_code = zip_code.replace(/[^0-9]/, '');
5 let url = "http://localhost:8060/zipcode/" + zip_code; 6
7 if (zip_code.length !== 8) {
8 return;
Description
Variables that are never re-assigned a new value after their initial declaration should be declared with the const
keyword.
This prevents the programmer from erroneously re-assigning to a read-only variable, and informs those reading the code that a variable is a constant value.
Bad Practice
let pi = Math.PI
for (let x of xs) {
use(x);
}
let { a, b } = object;
use(a, b);
Recommended
const pi = Math.PI
for (const x of xs) {
use(x);
}
const { a, b } = object;
use(a, b);