Interview :: 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.
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
Some of the advantages of JavaScript are:
- Server interaction is less
- Feedback to the visitors is immediate
- Interactivity is high
- Interfaces are richer
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.
The function which has named at the time of definition is called a named function. For example
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.
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:
Yes, you can assign an anonymous function to a variable.
The variables of JavaScript represent the arguments that are passed to a function.
In JavaScript, we need closures when a variable which is defined outside the scope in reference is accessed from some inner scope.