Demystifying Promises in JavaScript: How Do They Work?