Skip to main content

Posts

Showing posts from November, 2020

Destructuring in Arrays & Objects

 Today we will learn about the de structuring in java script. Let us take a simple example how a regular array is defined var capital =["Delhi","London","Paris"] now if we want to access London then we have to pass the value as capital[1].  Now an alternate way and when we want to remember the names rather than indexes to query an array is var [India,England,France] = ["Delhi","London","Paris"]  In here in order to access London we can say console.log(England) and the output would be London This is a simple way to de structure an array. Similarly we can do the same the for an object as well const myfav = { fruit : "apple" , color : "red" }; console . log (myfav); If we have multiple values in an object const myfav = [ { fruit : "apple" , color : "red" }, { fruit : "mango" , color : "yellow" } ]; Now if we have to get mango details then it shou

REST API (GET,POST,PUT,PATCH,DELETE)

 The word API means application programming interface. Predominantly they are two important protocols which are used in world a) SOAP API (Simple object access protocol) API b) REST API means representational state transfer API's are used to interact with the web applications, many of the major applications create API's so that the end users can interact with their platform programmatically. Similar to database where we can perform operations such as insert, update, delete. In API's also we can perform such operations. Rest API is one of the highest used API's in the current web applications So in Rest API we have the following methods calls a) Get - Get method is used to fetch the data from a web application b) Post - Post method is used to insert the data into a web application c) Delete - As the name suggests delete method is used to delete data from a web application, in here we can perform a select deletion or complete deletion as well d) Put - Put method is used t