cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - You can change your system assigned username to something more personal in your community settings. X

ES6 syntax error for Javascript Service

seanccc
17-Peridot

ES6 syntax error for Javascript Service

Hi, 

I found a very strange phenomenon,  the ES6 syntax like "let", "const" work well normally.  But in certain situation,  the Lint will report error, see the attached picture. 

 

The line #315 and #325 define the same variable name , but it's not the root cause.  Changing to different variable name has the same error. 

 

It seems the error occurs when the code lines exceeds about 310, but I'm sure . 

 

seanccc_0-1600413217864.png

 

Regards,

Sean

3 REPLIES 3
slangley
23-Emerald II
(To:seanccc)

Hi @seanccc.

 

If you try declaring this statement once instead of twice, does the behavior change:

 

  let intervalDays = interval;

 

Are there other errors elsewhere that may have a bearing on this one?

 

Regards.

 

--Sharon

seanccc
17-Peridot
(To:slangley)

Hi Sharon @slangley ,

 

Yes, for example, the code below doesn't declare the variable "j"  twice, but still has the error. 

 

seanccc_0-1604800707333.png

 

slangley
23-Emerald II
(To:slangley)

Hi @seanccc.

 

I'm afraid there are a number of unknowns here since we can't see the full code.  However, we would recommend reaching out to your Sales rep or contacting the Sales team to engage with a PTC consultant for assisting with a code review.  They can recommend ways to debug and improve your code.

 

Regards.

 

--Sharon

Top Tags