Facebook Pixel
call, apply, and bind Interview Questions

What is the output of foo.apply(obj, [5, 3]) where foo returns this.x + y + z and obj.x is 10?

The answer

18. apply sets this to obj (this.x = 10) and passes [5, 3] as y and z. 10 + 5 + 3 = 18.

More FAQs in call, apply, and bind Interview Questions

No. The first bind wins. bound.bind(newObj) does not change this. The bound function keeps the original this from the first bind call.

Array.prototype.slice.call(arguments). This borrows the slice method from Array.prototype and applies it to the array-like arguments object.

Nothing. The arrow function's this is lexical (inherited from the enclosing scope). bind, call, and apply cannot change an arrow's this.

Still have questions?

Browse all our FAQs or reach out to our support team

Want to upskill yourself?

Your learning library

Small steps. Big possibilities.

Find your next course. Build something great.

Our courses are taking a Coffee break, but your curiosity shouldn't. Stay engaged with namastedev linkedin, youtube, discord and other resources while you wait.

0

Success

Please Login.

Success

Please Login.

Success

Please Login.

Success

Please Login.

Success

Please Login.

Success

Please Login.

Success

Please Login.

Success

Please Login.

Success

Please Login.

Success

Please Login.

Success

Please Login.

Success

Please Login.

Success

Please Login.

Success

Please Login.

Success

Please Login.

Success

Please Login.

Success

Please Login.

Success

Please Login.

Success

Please Login.

Success

Please Login.