NA +91-8727899942 thecoderjob@gmail.com

CHAPTER - 1

Here is the example of how promise work in javascript.

Promise apply under getAsyncData function and it return resolved or rejected.

If it resolved then then() block is triggered else in the case of rejected catch() block

 

Here's is the Code !!

// Neel.B
const getAsyncData = () => {
	return new Promise((resolved,reject)=>{
		setTimeout(() => {
			resolved('This call is resolved !!')
		}, 2000) // function run after 2 seconds
	})
} 
getAsyncData().then((result)=>{
	console.log(result)
}).catch((err)=>{
	console.log(err)
})

Chapter 2

Copy by reference example in object || javascript

Previous chapter

Get In Touch

NA

thecoderjob@gmail.com

+91-8727899942

Popular Links

© www.thecoderjob.com. All Rights Reserved.               Designed by HTML Codex