1.

What will happen when the data of the jQuery.cache is read from an element?(a) Unique number is retrieved as elem[jQuery.expando](b) Data is read from jQuery.cache[id](c) Unique number is retrieved as elem[jQuery.expando] & Data is read from jQuery.cache[id](d) Data is cleared from jQuery.cache[id]I have been asked this question during an interview.Enquiry is from JavaScript and Memory Leak topic in chapter Caching, Debugging and Animation of JavaScript

Answer»

The correct choice is (C) UNIQUE number is retrieved as elem[jQuery.expando] & Data is READ from jQuery.cache[id]

The EXPLANATION is: jQuery.cache[id] is used to associate handlers and other data with elements. When the data is read from an ELEMENT:

The element unique number is retrieved from id = elem[ jQuery.expando].

The data is read from jQuery.cache[id].



Discussion

No Comment Found

Related InterviewSolutions