in Education by
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)

1 Answer

0 votes
by
{ name: this.name, review: this.review, rating: this.rating } This creates an object, which is a data structure. let product = {} Here you are assigning the object (data structure) to a variable.

Related questions

0 votes
    This question already has answers here: When to use ":"(colon) operator in javascript vs "=" operator ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jun 2, 2022 in Education by JackTerrance
0 votes
    This question already has answers here: How to split a string with angularJS (4 answers) Closed 5 years ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jul 14, 2022 in Education by JackTerrance
0 votes
    This question already has answers here: How to split a string with angularJS (4 answers) Closed 5 years ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jul 3, 2022 in Education by JackTerrance
0 votes
    This question already has answers here: How to split a string with angularJS (4 answers) Closed 5 years ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jun 19, 2022 in Education by JackTerrance
0 votes
    I have a custom input validation component that I use in a form. Something like 15 instances of this ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 17, 2022 in Education by JackTerrance
0 votes
    I asked a question yesterday and none of the answers are working so I decided to start a fresh one ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 29, 2022 in Education by JackTerrance
0 votes
    I am looking for a way to close a component when there it a click outisde of the element. I ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 19, 2022 in Education by JackTerrance
0 votes
    This question already has answers here: How to access the correct `this` inside a callback (13 answers) ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 4, 2022 in Education by JackTerrance
0 votes
    This question already has an answer here: Object.assign getters and setters in constructor (1 answer) Closed ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 17, 2022 in Education by JackTerrance
0 votes
    This question already has an answer here: Object.assign getters and setters in constructor (1 answer) Closed ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 17, 2022 in Education by JackTerrance
0 votes
    This question already has answers here: JavaScript: Difference between .forEach() and .map() (15 answers) ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 7, 2022 in Education by JackTerrance
0 votes
    I'm trying to use the sensor's API with react and I can't seen to be able to make it work ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 12, 2022 in Education by JackTerrance
0 votes
    I'm trying to use the sensor's API with react and I can't seen to be able to make it work ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 10, 2022 in Education by JackTerrance
0 votes
    I created a raycaster that allows me to pick an object from the scene with my mouse like such: ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 9, 2022 in Education by JackTerrance
0 votes
    I have a function that has more than 1400+ crypto pairs and I have to send an API against each ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 5, 2022 in Education by JackTerrance
...