Home / Interview / JavaScript :: General Questions

Interview :: JavaScript

1) What is JavaScript?

JavaScript is a scripting language. It is different from Java language. It is object-based, lightweight, cross-platform translated language. It is widely used for client-side validation. The JavaScript Translator (embedded in the browser) is responsible for translating the JavaScript code for the web browser.

2) List some features of JavaScript.

Some of the features of JavaScript are:

  • Lightweight
  • Interpreted programming language
  • Good for the applications which are network-centric
  • Complementary to Java
  • Complementary to HTML
  • Open source
  • Cross-platform
3) List some of the advantages of JavaScript.

Some of the advantages of JavaScript are:

  • Server interaction is less
  • Feedback to the visitors is immediate
  • Interactivity is high
  • Interfaces are richer
4) List some of the disadvantages of JavaScript.

Some of the disadvantages of JavaScript are:

  • No support for multithreading
  • No support for multiprocessing
  • Reading and writing of files is not allowed
  • No support for networking applications.
5) Define a named function in JavaScript.

The function which has named at the time of definition is called a named function. For example

6) Name the types of functions

The types of function are:

  • Named - These type of functions contains name at the time of definition. For Example:
  • Anonymous - These type of functions doesn't contain any name. They are declared dynamically at runtime.
7) Define anonymous function

It is a function that has no name. These functions are declared dynamically at runtime using the function operator instead of the function declaration. The function operator is more flexible than a function declaration. It can be easily used in the place of an expression. For example:

8) Can an anonymous function be assigned to a variable?

Yes, you can assign an anonymous function to a variable.

9) In JavaScript what is an argument object?

The variables of JavaScript represent the arguments that are passed to a function.

10) Define closure.

In JavaScript, we need closures when a variable which is defined outside the scope in reference is accessed from some inner scope.