Another answer suggested adding control characters into the text, but as someone commented this approach has it's downsides.
The reason you get the digits to the left no matter the order of the string is because you are using an LTR element (or the browser's console which is always LTR). Then if the digits come first they start at the left, and if the arabic letters come first they start at the right because arabic letters have "hard" RTL directionning even inside an LTR element.
However, if you are using an RTL element and put the digits first, it will show up as intended:
<div dir="rtl">123عينات</div>
Or dynamically with JavaScript:
var data = "عينات";
var num = "123";
var res = num + data;
var el = document.createElement('div');
el.dir = "rtl";
el.textContent = res;
document.body.append(el);