JSFiddle - React, Tailwind, and code Playground

HTML

<div dir="ltr" id="foo">bar</div>

<div style="direction:ltr" id="baz">quux</div>

<div dir="ltr"><div id="jeez">whiz</div></div>

JavaScript

Array.prototype.forEach.call(document.querySelectorAll('#foo, #baz, #jeez'), function (elem) {
    console.log(getComputedStyle(elem).direction);
});