Unexpected string concatenation
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");
Unexpected string concatenation
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");
Unexpected string concatenation
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");
Unexpected string concatenation
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
In ES2015 (ES6), we can use template literals instead of string concatenation.
var str = `Hello, ${name}!`;
Bad Practice
var str = "Hello, " + name + "!";
var str = "Time: " + (12 * 60 * 60 * 1000);
Recommended
var str = "Hello World!";
var str = `Hello, ${name}!`;
var str = `Time: ${12 * 60 * 60 * 1000}`;
var str = "Hello, " + "World!";