Nowadays most of the js interview- prescreening round have this statement validation questions to know about the candidate js fluency. If the candidate understands the basics of javascript and execution flow, they can easily clear it.

Some of the following examples might help you to understand the type of questions.

If you have feedback and suggestion feel free to give your comments.

Reach out to me at Twitter, LinkedIn.

--

--

Recently, I had the situation to handle one of the WordPress based websites.

In one of the new changes, due to the environment dependency the shared code not worked in our server machine. So we had planned to solve the issue with the help of docker components.

When we do…

--

--

Scope: code block

In the code block, the declared variable can be accessible within a specific block {....} , and all of its declared sub-functions. You can understand it with examples of -let, const, var.

Context: object association

this.property or this._function()

It refers to the object associated with the specific execution block to the reference of this keyword. A plain function context-this consider as Global(node) or Window(browser) object and in strict mode context-this consider as undefined.

Context and Scope

If you have feedback and suggestion feel free to give your comments.

Reach out to me at Twitter, LinkedIn.

--

--

Each method can be used for different purposes.

JS- call vs apply vs bind

call, apply, bind :

Both call and apply executes the function with the given context this and parameters.

call- When you know the exact parameter, it’s better to use call because we need to pass the parameter directly.

apply- Parameters will be passed as an array, on the execution, it will be passed according to the order.

bind it just returns a function reference, with context association of passed object and we can call the function anytime in the future with parameters.

If you have feedback and suggestion feel free to give your comments.

Reach out to me at Twitter, LinkedIn.

--

--