M

Manisha Agrawal • 9.34K Points
Tutor III

Q. What will the following code snippet work? If not, what will be the error?

Code:
function test(p)
{
for (; p.next; p = p.next) ;
return p;
}
  • (A) No, this will not iterate
  • (B) No, this will result in a runtime error with the message “Cannot use Linked List”
  • (C) No, this will throw an exception as only numerics can be used in a for loop
  • (D) Yes, this will work
  • Correct Answer - Option(D)
  • Views: 147
  • Filed under category JavaScript

No solution found for this question.
Add Solution and get +2 points.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.


Question analytics