Promise Chaining Javascript

Example

getUserData(userId) 
	.then(user => getPosts(user))        // Pass user to getPosts
	.then(posts => getComments(posts))   // Pass posts to getComments
	.then(comments => {                  // 
		console.log(comments);           // Do something with comments
	})
	.catch(error => console.error(error));// Handle any errors