why we need promises in javascript 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));