files/en-us/web/api/medialist/index.md
{{APIRef("CSSOM")}}
The MediaList interface represents the media queries of a stylesheet, e.g., those set using a {{htmlelement("link")}} element's media attribute.
[!NOTE]
MediaListis a live list; updating the list using properties or methods listed below will immediately update the behavior of the document.
MediaList as text, and also allows you to set a new MediaList.MediaList.MediaList.MediaList.MediaList. This method can also be called using the bracket ([]) syntax.The following would log to the console a textual representation of the MediaList of the first stylesheet applied to the current document.
const stylesheets = document.styleSheets;
let stylesheet = stylesheets[0];
console.log(stylesheet.media.mediaText);
{{Specifications}}
{{Compat}}