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


Q15)Which variable is an implicit parameter for every function in JavaScript?
a) Arguments
b) args
c) argsArray
d) argumentsList

I hope you like the article. Please stay connected for more such articles.

Please check the comment section for answers and if any doubts let me know there. 


You can also follow me on Twitter or Linkedin for the latest updates.

Written By:

Saurabh Joshi

Comments

Post a Comment

Popular Posts