JSFiddle - React, Tailwind, and code Playground

by Shaan Singh

HTML

<body>
    <p><span id="neg">-1</span> 2 3 4</p>
</body>

CSS

body {
    direction: rtl;
}

JavaScript

var element = document.body,
    style = window.getComputedStyle(element),
    direction = style.getPropertyValue('direction');

if (direction == "rtl") {
    document.getElementById("neg").innerHTML = "1-";
}