Most Important JavaScript fact should know every junior programmer.
01. What is the difference between Double equal (==) and Triple equal (===) in JavaScript ?
Both of these comparison operators have equality operators, the triple equals, ===, is what’s called a strict equality operator while the double equals are equality operators.
In order to evaluate the equality operator, the value and the type of the operands must match. If the value and the type are not the same, the comparison evaluation will evaluate to false.
For example:
4 === “4” //won’t evaluate because the left operand is of type ‘number’ while the right operand is of type ‘string’.
Because the equality operator uses those operands that are already the same type (if not already) before they are compared, the code block below will evaluate to true.
4 == “4” //The Value will evaluate to ‘true’
02. Simple Explanation of Scope in JavaScript.
When you use JavaScript, the concept of scope, or the ability of variables to be available, is paramount. This concept will be explained in further detail below.
Local variables are those declared within a block; global variables are those declared outside of a block. Scope states the current block within a block in JavaScript, so variables accessible from JavaScript will be local variables.
03. what is closure in JavaScript ?
Closed functions result in their surrounding state referred to as their lexical environment. When JavaScript is used, closures are created whenever a function is created, at function creation time.
04. what is private variable? (for all languages included JavaScript).
For example, a private variable can be made only visible to the current class. It cannot be accessed outside the scope of the class or its sub classes. In Java (and most other popular programming languages), we can do this by declaring the variable with the private keyword.
05. encapsulation in JavaScript.
It is a process capable of encapsulating variable data with functions that use that data. Therefore it is possible to validate and safely control data. To achieve the JavaScript Encapsulation: — Use var keyword to make data members private.
06. JavaScript Global Variable.
A global variable in JavaScript is a variable declared outside the function or declared as part of the window object. Any JavaScript function may access it.
07. What is JavaScript ?
JavaScript is a high-level, time-saving programming language that is often compiled just-in time, as well as with curve bracket syntax, prototype-oriented, object-oriented, and first-class functions.
08. Key features of JavaScript.
A script language that is object-oriented and client-integrated Validated by the user’s input Else and If Statement Interpreters that offer the power to combine inbuilt features Light weight, yet delicate statements Using a looping mechanism to handle events etc.
09. What is DOM ?
Document Object Models (DOM) are used to represent HTML and XML documents, allowing programs to alter the structure, style and content as well as formatting them. DOM represents web pages in an object-oriented manner in accordance with the Java Script programming language.
10. What is an API ? (Application Programming Interface).
You’re using APIs whenever you use Facebook, send instant messages, check your weather, use your phone’s weather app, and so on. API is short for Application Programming Interface, and it’s basically the bridge that connects two applications.
11. The Purpose of API.
Taking this challenge on is an important task, and a key tool is the Application Programming Interface (API). An API is a way for other programs to interact with a program without the developer having to share the program’s entire code.
12. The “ GET ”method in JavaScript.
It performs an asynchronous http GET operation to retrieve data from the server. Syntax: $. … data: data to be sent to the server with the request as a query string. callback: function that should be executed when the request occurs.
13. The “POST ”method in JavaScript.
Send asynchronous http POST requests to retrieve data from the server, without needing to reload entire page by using post() method. Support for type parameter for the type of response data, specify ‘JSON’ if server returns JSON data.
14. How recursion works in JavaScript?
Recursion in programming is called when a function is called within itself until a condition is reached. JavaScript is pass by reference because that means the function is passed as an argument, and can then be called within itself.
15. recursion vs iteration.
A recursion and an iteration refer to processes where a set of instructions is repeated. Recursion is essentially repeating a function until a condition is met, whereas iteration is repeated iteration which depends on a certain condition to stop.
Emphasis of Iteration:
In a program, a series of code statements that are repeated over and over until a particular task is completed.
Emphasis of recursion:
Essentially, the problem is solved by solving the sub-problems one by one till we reach the trivial version or the base case.
“We have now reached the end of our journey in the world of functional programming, but there is still much more to learn about this discipline.”