How should you comp...
 
Notifications
Clear all

How should you complete the trigger? NOTE:

1 Posts
1 Users
0 Likes
155 Views
(@sitesmario)
Noble Member
Joined: 2 years ago
Posts: 734
Topic starter  

HOTSPOT

You have a web service that is used to pay for food deliveries. The web service uses Azure Cosmos DB as the data store.

You plan to add a new feature that allows users to set a tip amount. The new feature requires that a property named tip on the document in Cosmos DB must be present and contain a numeric value.

There are many existing websites and mobile apps that use the web service that will not be updated to set the tip property for some time.

How should you complete the trigger? NOTE: Each correct selection is worth one point.

Show Answer Hide Answer

Suggested Answer:

Explanation:

Box 1: getContext().getRequest();

Box 2: if(isNaN(i)["tip"] ..

In JavaScript, there are two ways to check if a variable is a number :

isNaN() C Stands for “is Not a Number”, if variable is not a number, it return true, else return false.

typeof C If variable is a number, it will returns a string named “number”.

Box 3:r.setBody(i);

// update the item that will be created

References:

https://docs.microsoft.com/bs-latn-ba/azure/cosmos-db/how-to-write-stored-procedures-triggers-udfs

https://mkyong.com/javascript/check-if-variable-is-a-number-in-javascript/


   
Quote

Latest Microsoft AZ-204 Dumps Valid Version

Latest And Valid Q&A | Instant Download | Once Fail, Full Refund
Share: