in JavaScript by
If the following piece of JavaScript code is executed, will it work if not, what kind of possible error can occur?

function fun(o)  

{  

for(;o.next; oo =o.next);  

return o;  

}  

a) Yes, it will work fine

b) No, this will not iterate at all

c) No, it will throw an exception as only numeric's can be used in a for loop

d) No, it will produce a runtime error with the message "Cannot use Linked List"

1 Answer

0 votes
by

Answer: A

Reason: In the above-given code, the For loop statement is used for traversing the linked list data structure, which returns the last element of the list. So it is definitely going to work without throwing any exception.

Related questions

0 votes
asked Mar 21, 2021 in JavaScript by rajeshsharma
0 votes
asked Mar 23, 2021 in JavaScript by sharadyadav1986
0 votes
asked Mar 21, 2021 in JavaScript by rajeshsharma
...