Dynamics 365 Web API can be called and accessed using JavaScript. You can use Web API with HTML web resources, form scripts, and ribbon commands to perform various operations on data.
Web API is very convenient to use with JavaScript as it returns results in the form of JSON objects that can be easily converted to JavaScript objects.
In Dynamics 365, Web API is used mainly with HTML web resources and in Single Page Applications.
The main benefit of using Web API in JavaScript web resources is that you will not need to authenticate because web resources are a part of the application and can be accessed by authenticated users only. You can directly write a code for Web API operations in the JavaScript web resource, and perform operations.