using promises js code example
Example: making promises in js
getData()
.then(data => console.log(data))
.catch(error => console.log(error));
getData()
.then(data => console.log(data))
.catch(error => console.log(error));