This question already has answers here:
When to use ":"(colon) operator in javascript vs "=" operator? (3 answers)
Closed 3 years ago.
I have a onSubmit() method in Vuejs. Couldn't figure what is the difference between equal = and colon : sign. Here is the following cod
methods:{
onSubmit(){
let product= {
name: this.name,
review: this.review,
rating: this.rating
},
this.name=null,
this.review=null,
this.rating=null
}
}
In the above function I am storing values in object called product, after storing values I am assigning null values to data variables.
Why we are passing values to product object using : and to data object using = sign?
JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)