Question 12
Consider the below javascript program.
async function result (x) { const y = 6; return new Promise ((reject, resolve) => { if (((x * 28) / (7 * x) - 2) == 1) reject(y ** 2) console.log("Inside Promise") resolve(y ** 3) })}
result(x).then(rej => console.log("Promise rejected with the value", rej),res => console.log("Promise resolved with the value", res)).then(data => { console.log("Data received is", data); return "6"}).finally(data => { console.log("Data received is", data); return "34"}).then(data => console.log("Data received is", data))Assuming the variable “x” passed to the “result” function is a whole number between 1 and 99 (including 1 and 99), what will be shown on the console, if the above program is executed?
Promise resolved with the value 36
Data received is 36
Data received is 6
Data received is 34Inside Promise
Promise rejected with the value 36
Data received is undefined
Data received is undefined
Data received is 34Promise rejected with the value 216
Data received is undefined
Data received is undefined
Data received is 34Inside Promise
Promise rejected with the value 216
Data received is undefined
Data received is undefined
Data received is 6