javascript snippets interview questions set 3
For the previous set please refer to javascript snippets questions set 2.
Let's begin with set 3,
Q12)After the following code, what is the value of a.length?
var a = ['dog', 'cat', 'hen'];
a[100] = 'fox';
a) 101
b) 3
c) 4
d) 100
Q13)What is the value of dessert.type after executing this code?
const dessert = { type: 'pie' };
dessert.type = 'pudding';
a) pie
b) The code will throw an error.
c) pudding
d) undefined
Q14)Why would you include a "use strict" statement in a JavaScript file?
a) to tell parsers to interpret your JavaScript syntax loosely
b) to tell parsers to enforce all JavaScript syntax rules when processing your code
c) to instruct the browser to automatically fix any errors it finds in the code
d) to enable ES6 features in your code
1)a 2)b 3)b 4)a
ReplyDeleteQ13 should be C
DeleteQ15 A should be arguments
Ya q13 is c) is by mistake.
ReplyDeleteQuestion number 12
ReplyDelete