Modern Application Development II, Quiz 2
Consider the below JavaScript program.
const first = "Hello 3";
const obj1 = { first: "Hello 1", secondFunc: function () { console.log(this.first); }}
const obj2 = { first: "Hello 2", secondFunc: function () { console.log(this.first); this.secondFunc(); }}
obj1.secondFunc.apply(obj2, [2, 5, 9]);What will be the output of the above program, if executed?
Consider the below JavaScript program. const first = "Hello 3"; const obj1 = { first: "Hello 1", secondFunc: function () { console.log(this.first); } } const obj2 = { first: "Hello 2", secondFunc: function () { console.log(this.first); this.secondFunc(); } } obj1.secondFunc.apply(obj2, [2, 5, 9]); What will be the output of the above program, if executed? Consider the following Vue application with markup “index.html” and JavaScript file “app.js”. index.html: <div id = "app"> <my-comp> <template #header> This is header content </template> <template #footer> This is footer content </template> <p> This is some content </p> </my-comp> </div> <script src = "app.js"> </script> app.js: Vue.component("myComp", { template : `<div> <p> <slot></slot> </p> <p> <slot name="footer"></slot> </p> </div> `, }) const app = new Vue({ el : "#app", }) Suppose you open the “index.html” file in a browser. What will be rendered by the browser? Consider the following application with markup index.html and script app.js. index.html: <body> <div id="app"> <router-view></router-view> </div> </body> app.js: const Header = { template: `<div>This is header <router-view /> </div>`, } const Error = { template: '<div> 404 Page not found</div>', } const Profile = { template: `<div> Welcome to profile page</div>`, } const routes = [ { path: '/', component: Header, children: [ { path: 'profile', component: Profile }, { path: '*', component: Error }, ], }, ] const router = new VueRouter({ routes, }) new Vue({ el: '#app', router, }) Suppose the application is running on <u>http://127.0.0.1:8080</u>. What will be rendered in the browser?