Forum Discussion
JavaScript Text Direction
Basically i added a function to reverse any part of your text to it.
As you can see the first line both the number and my name are RTL... As i am not 100% sure if that was correct...i added a function to get parts of your string and revert those.function reverse(s){
return s.split("").reverse().join("");
}
This is the function that does that. In the Storyline added i commented a lot, just to see if it works. And i pass the name and score to a separate array... that might not be necessarry... you have to test that. Only thing thats really needed is converting any value sending to reverse function into a string ( toString() ) Either directly, or in the function itself.
Just tried that by changing the function to this:function reverse(s){
s = s.toString();
return s.split("").reverse().join("");
}
Works fine.