You need to sign in to do that
Don't have an account?
Lwc Seekar
wat does this mean in JS - lwc
code snippet:
handleSearchKeyChange(event){
console.log(event.target.value)
console.log('value==='+event.target.value)
this.filters = {...this.filters, "searchKey":event.target.value}
console.log('this.filters=below==='+json.stringify(this.filters))
}
i want to know what comes output in higlighted one and how to debug it. i know its a split operator. can you explain a little detail.
if i dont keep json.stringify(this.filters) - i get output in console.log as [object ,object]
if i keep json.stringify(this.filters) - i get my component error.
handleSearchKeyChange(event){
console.log(event.target.value)
console.log('value==='+event.target.value)
this.filters = {...this.filters, "searchKey":event.target.value}
console.log('this.filters=below==='+json.stringify(this.filters))
}
i want to know what comes output in higlighted one and how to debug it. i know its a split operator. can you explain a little detail.
if i dont keep json.stringify(this.filters) - i get output in console.log as [object ,object]
if i keep json.stringify(this.filters) - i get my component error.
Hi Lwc Seekar,
if you are using JSON.stringify which converts a JavaScript value to a JSON string, Javascript is a case-sensitive language and it will show an error if you use json in small.
I tried this code in my org and it works fine, have a look
handleKeyUp(evt) {
this.filters = {...this.filters, "searchKey":evt.target.value};
console.log('this.filters=below==='+JSON.stringify(this.filters));
console.log('OUTPUT2 : ',this.filters);
}
If you found this helpful. mark it as the best answer.
Thank You