Question 6
Consider the below javascript program, and predict the output, if executed.
const data = { count: 10};
const newData = {}
Object.defineProperty(newData, 'count', { get() { return data.count; }, set(newValue) { data.count = newValue; },});console.log("Before Update:", newData.count);newData.count = 20;console.log("After Update:", data.count);Before Update: 10
After Update: 10Before Update: 10
ErrorBefore Update: 10
After Update: 20Before Update: 10
After Update: undefined