Skip to main content

Posts

Showing posts from February, 2020

How to get Total, max and min number from an array of numbers?

Get total, max and min number from an array of numbers: var numArr = [17,18,19,20,53,65,78,99,12,35]; var total=0; numArr.forEach(function(d,k){  total += d //or total = totl + d }); console.log(total); // 416 Finding max: Math.max(...numArr); OR console.log(Math.max.apply(null, numArr)); Finding minimum: Math.min(...numArr) console.log(Math.min(...numArr)); or Math.min.apply(null, numArr); console.log(Math.min.apply(null, numArr));

How fetch access token from a Microsoft Graph API in jquery?

Get access token from a Microsoft Graph API in jquery: Token request: You send a POST request to the /token identity platform endpoint to acquire an access token: // Line breaks are for legibility only. POST https://login.microsoftonline.com/{tenant}/oauth2/v2.0/token HTTP/1.1 Host: login.microsoftonline.com Content-Type: application/x-www-form-urlencoded client_id= 535fb089-9ff3-47b6-9bfb-4f1264799865 scope= https://graph.microsoft.com/.default client_secret= qWgdYAmab0YSkuL1qKv5bPX.... grant_type= client_credentials Parameter Condition Description: tenant Required The directory tenant that you want to request permission from. This can be in GUID or friendly name format. client_id Required The Application ID that the Azure app registration portal assigned when you registered your app. scope Required The value passed for the scope parameter in this request should be the resource identifier (Application ID URI) of the resource you want, affixed with the .def...