DEV Community

Arya Krishna
Arya Krishna

Posted on

JavaScript Technical Interview Questions 2

Q. Which statement below is not true about functions in JavaScript?

  • Functions can be reused throughout your code
  • Functions can receive arguments that can alter the output of a function
  • Functions are able to be recursive.
  • A function must always be assigned an identifier

Answer - A function must always be assigned an identifier

Functions without identifiers are called anonymous functions which are used quite frequently used in JavaScript.

Q. What are the two types of scope JavaScript uses?

  • Global and Local
  • Abroad and Local
  • Outside and Inside
  • Surrounding and Inner

Answer - Global and Local

Q. As a developer, I want to be able to remove the last element of my array and I want to also be able to add a new element to the beginning of my array. Which two array methods should I use?

  • concat() and shift()
  • forEach() and pop()
  • push() and sort()
  • pop() and unshift()

Answer - pop() and unshift()

The pop array method removes the last element of an array and the unshift method adds an element to beginning of the array.

Q. How do we access a value stored in an object?

  • Period notation, Square bracket notation
  • Dot notation, Bracket notation
  • Dot notation, Curl bracket notation
  • Equal notation, Abstract notation

Answer - Dot Notation & Bracket Notation

We have two ways of accessing data inside of an object, dot notation and bracket notation.

Q. What is an object method?

  • An array saved inside of an object
  • Keys in an object that have a number assigned to it
  • A function associated with an object
  • A function that takes an object for an argument

Answer - A function associated with an object

Q. What is the purpose of the 'This' operator?

  • The keyword 'This' refers to the object it is in. 'This' changes based on which object it is in when being called.
  • This' is an array where we can easily store global variables for when we need access to them.
  • This' keyword lets us make a reference to our window gives us access to special object methods.
  • This' keyword allows us to specify certain variables to it which can be used in the global scope.

Answer - The keyword 'This' refers to the object it is in. 'This' changes based on which object it is in when being called.

Q. From the reason listed below which is NOT true about JavaScript.

  • JavaScript increases interactivity of our websites.
  • Javascript allows developers to create richer interfaces for the users.
  • JavaScript lets provide the user immediate feedback upon an action.
  • JavaScripts handles numbers better than most programming languages.

Answer - JavaScripts handles numbers better than most programming languages.

Discussion (0)