how to generate random text in vue js 1

how to generate random text in vue js

      const recipeData = {
        id: Math.ceil(Math.random()*1000000), //randomly generated id
        title: this.title,
        description: this.description,
        imageUrl: this.imageUrl,
        ingredientsName:  this.ingredientsName,
        ingredientsQuantity: this.ingredientsQuantity
      };

Here is what the above code is Doing:
1. We are creating a new object called recipeData.
2. We are assigning a randomly generated id to the id property of the recipeData object.
3. We are assigning the value of the title property of the recipeData object to the value of the title property of the recipeForm object.
4. We are assigning the value of the description property of the recipeData object to the value of the description property of the recipeForm object.
5. We are assigning the value of the imageUrl property of the recipeData object to the value of the imageUrl property of the recipeForm object.
6. We are assigning the value of the ingredientsName property of the recipeData object to the value of the ingredientsName property of the recipeForm object.
7. We are assigning the value of the ingredientsQuantity property of the recipeData object to the value of the ingredientsQuantity property of the recipeForm object.

Similar Posts