Skip to main content

Posts

Showing posts from November, 2020

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 connect

javascript snippets interview questions set 2

For the previous set please refer to javascript snippets questions set 1. Let's  begin with set 2, Q6)What is the result of running this code? sum(10, 20); diff(10, 20); function sum(x, y) {   return x + y; } let diff = function (x, y) {   return x - y; };  a) 30, ReferenceError, 30, -10  b) 30, ReferenceError  c) 30, -10  d) ReferenceError, -10 Q7)Which of the following values is not a Boolean false?  a) Boolean(0)  b) Boolean("")  c) Boolean(NaN)  d) Boolean("false") Q8)For the following class, how do you get the value of 42 from an instance of X? class X {   get Y() {     return 42;   } } a) x.get('Y') b) x.Y c) x.Y() d) x.get().Y  Q9)What's one difference between the async and defer attributes of the HTML script tag?  a) The defer attribute can work synchronously.  b) The defer attribute works only with generators.  c) The defer attribute works only with promises.  d) The defer attribute will asynchronously load the scripts in order. Q10)What val

javascript snippets interview questions set 1

  Hey, I have just started a new set for javascript snippets  interview questions which will make your understanding of javascript more clear. It's more like testing your knowledge and then clearing things that you have doubt or if you have heard for the first time about it. So let's begin with testing and improving yourself, Q1. Which operator returns true if the two compared values are not equal?  a)<>  b)~  c)==!  d)!== Q2. How is a forEach statement different from a for a statement?  a)Only a for statement uses a callback function.  b)A for statement is generic, but a forEach statement can be used only with an array.  c)Only a forEach statement lets you specify your own iterator.  d)A forEach statement is generic, but a for statement can be used only with an array. Q3. Which statement creates a new object using the Person constructor?  a)var student = new Person();  b)var student = construct Person;  c)var student = Person();  d)var student = construct Person(); Q4. W