Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save chris-castillo-dev/8ba020d713980654e14d5cff0566a8c7 to your computer and use it in GitHub Desktop.
Save chris-castillo-dev/8ba020d713980654e14d5cff0566a8c7 to your computer and use it in GitHub Desktop.
// Get the <body> element
const bodyElement = document.querySelector('body');
// Extract all classes on the <body> element
const bodyClasses = Array.from(bodyElement.classList);
// Join the classes into a comma separated string
const bodyClassesString = bodyClasses.join(',');
return bodyClassesString;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment