Visualize string positions with JavaScript