Modern Application Development II, Quiz 2
Consider the below JavaScript program.
function main() { var count = 0; function increment(num = count++) { count += num; } increment(); increment(2); increment(); console.log(count);}main();What will be the output of the above program?
Consider the below JavaScript program. function main() { var count = 0; function increment(num = count++) { count += num; } increment(); increment(2); increment(); console.log(count); } main(); What will be the output of the above program? Consider the below Vue component. <template> <div> <p>{{ message }}</p> <button @click="updateMessage">Change Message</button> </div> </template> <script> export default { data() { return { message: 'Hello' }; }, methods: { updateMessage() { this.message = this.message === 'Hello' ? 'World' : 'Hello'; } } }; </script> What will be displayed in the `<p>` element, after the button with text “Change Message” is clicked? Consider the below JavaScript program. async function asyncFunc() { try { const result1 = await Promise.resolve('Start'); console.log(result1); const result2 = await new Promise((resolve, reject) => { setTimeout(() => reject('Error'), 100); }); console.log(result2); } catch (error) { console.log('Caught:', error); } return 'End'; } asyncFunc().then(result => console.log(result)); What will be the output of the program?