question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Incorrect] answer to array method bind

See original GitHub issue

Describe the bug For the question Array Method Binding, an incorrect answer is set to correct answer.

Expected behavior The expected output is

1
2
3

And since it is not an option, the right answer should be Something else.

Possible update: Change the question to:

const reduce = ['a', 'b', 'c'].reduce.bind([1, 2, 3]);
reduce((acc, cur) => acc + cur, '');

The options being:

  • 123
  • abc
  • An error is thrown
  • Something else

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

3reactions
acagastyacommented, Oct 20, 2019

The only reason I got my answer wrong is that I was expecting it on new lines, and it was not in the option. If we are going for the subtle things, I think this should be considered.

2reactions
hn3000commented, Jan 21, 2020

True. Same happens in the Superman / Batman example. But I can also understand @nas5w when he says “I don’t really want to get into technicalities surrounding whether there are line breaks in the console output.”

Read more comments on GitHub >

github_iconTop Results From Across the Web

Javascript call() & apply() vs bind()? - Stack Overflow
call and apply call a function while bind creates a function. Though with call() you pass arguments individually and apply() as an argument...
Read more >
Function.prototype.bind() - JavaScript - MDN Web Docs - Mozilla
The bind() method creates a new function that, when called, has its this keyword set to the provided value, with a given sequence...
Read more >
Getting Out of Binding Situations in JavaScript - A List Apart
It takes two arguments: the binding object, and an array of the arguments to be passed to the function. Here's an example based...
Read more >
JavaScript Function bind() Method - W3Schools
With the bind() method, an object can borrow a method from another object. The example below creates 2 objects ... The bind() method...
Read more >
5. Working with Arrays and Loops - JavaScript Cookbook [Book]
Solution. Use the Array object slice method to create a new array based on elements within a given range: var ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found