Wednesday, June 5, 2024
 Popular · Latest · Hot · Upcoming
8
rated 0 times [  12] [ 4]  / answers: 1 / hits: 112618  / 7 Years ago, sat, october 21, 2017, 12:00:00

I am trying to fix my code using eslint and its throwing an error saying:



cName:  + ANR + ,



Unexpected string concatenation




const ANR = 'Animal Friend,ANR,ANP,$30';

const specialityPlates = [{
cName: 'Environmental / Wildlife',
oSubMenu: [{
cName: + ANR + ,
cReturn: + ANR + |27.00
},
{


What is wrong with the concatenation in this string?


More From » jquery

 Answers
1

Try using a template literal.


ie.


const ANR = 'Animal Friend,ANR,ANP,$30'
const specialityPlates = [
{
cName: 'Environmental / Wildlife',
oSubMenu: [{
cName: `${ANR}`, // "Animal Friend,ANR,ANP,$30"
cReturn: `${ANR}|27.00` // "Animal Friend,ANR,ANP,$30|27.00"
}]
}
]

[#56168] Wednesday, October 18, 2017, 7 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
emileef

Total Points: 724
Total Questions: 108
Total Answers: 102

Location: Romania
Member since Sun, Dec 20, 2020
4 Years ago
;