JSFiddle - React, Tailwind, and code Playground

HTML

<html>
    <head></head>
    <body class="article landingPage">
        <h1>Testing out my ready handler solution</h1>
    </body>
</html>

JavaScript

// using jQuery.hasClass within the ready handler is much simpler
$(function() {
    var body = $("body");
    if(body.hasClass("article")) {
        alert("some article specific code");
    }
    if(body.hasClass("landingPage")) {
        alert("some landing specific code");
    }
});

// isn't that better than this?
/*
var readyFuncs = {
    article : function(){ 
        alert("some article specific code");
    },
    landingPage : function(){
        alert("some landing specific code");
    }
};

$(function() {
    var body = document.getElementsByTagName("body")[0],
        bodyClasses = body.getAttribute("class").split(" "),
        i = 0,
        readyFunc;
   
    for(i = 0; i < bodyClasses.length; i++) {
        var readyFunc = readyFuncs[bodyClasses[i]];
        if(readyFunc) { //ensure has been defined
            readyFunc();
        }
    }
});
*/