function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
lightning devloperlightning devloper 

Unexpected console statement. eslint(no-console) error in lightning web component, how to use console.log() and alert in lightnng web component

i am not able to debug my lightning web component javaScript code. am using console.log / window.alert() statements. but it's showing following error :
Unexpected console statement. eslint(no-console)
Unexpected console statement. eslint(no-alert)

any help will be appreciated
Best Answer chosen by lightning devloper
sfdcMonkey.comsfdcMonkey.com
for this you need to enable console statement with ESLint rules. add following lins in your code :
 
/* eslint-disable no-console */

checkout following post on same topic with exmaple : 

http://sfdcmonkey.com/2019/08/05/use-console-function-lwc/

let us know if it helps you 
thanks 

All Answers

sfdcMonkey.comsfdcMonkey.com
for this you need to enable console statement with ESLint rules. add following lins in your code :
 
/* eslint-disable no-console */

checkout following post on same topic with exmaple : 

http://sfdcmonkey.com/2019/08/05/use-console-function-lwc/

let us know if it helps you 
thanks 
This was selected as the best answer
sony xperiasony xperia
Hi Piyush,

Can you please help  me in lwc to write the custom sorting datable where i can apply the css aprt also .
Thanks in  Advance.