Help me understanding source code of promise constructor

Help me understanding source code of promise constructor
0

This is my code .

function promis(callBack){
	

	Object.prototype.thens=(values)=>{
	let k=false
		callBack((value)=>{
		k=true
		setImmediate (()=>{
			
			
		return	values (value)
		
		})
		
			},()=>{
				return false
				})
			
	return k
		
		}
	
	
Object.prototype.catchs=(catchsCallBack)=>{
	
	callBack(()=>{
	return false	
		},(value)=>{
		
	setImmediate(()=>{
		
		catchsCallBack(value )
		})
		
		})
	
	
	
	}	
	
	
	}
	
	
	let p=new promis((resolve,regect)=>{
console.log("promis callback")

	resolve("posetive")
			regect("error")
		
		
	
	
		
		
		})
p.thens((j)=>{

	console.log(j)
	return j
	}).catchs((err)=>{
		
		console.log(err)
		})

Is it correct. If not, what is the source code of Promise constructor

Where is the link to the challenge?

This is not the part of challenge. I am trying to learn how promise is implemented in JavaScript. Anyway thank you for replaying.