Cookies are small text files that websites place in a browser for tracking or login purposes. Meanwhile, localStorage and sessionStorageare new objects, both of which are storage specifications but vary in scope and duration. Of the two, localStorageis permanent and website-specific whereassessionStorageonly lasts as long as the duration of the longest open tab?