Home  >  Article  >  Web Front-end  >  Use js to implement data formatting_javascript skills

Use js to implement data formatting_javascript skills

WBOY
WBOYOriginal
2016-05-16 16:29:251376browse

Formatting is to convert any type of data into a string through format operations. For example, below

Copy code The code is as follows:

<script><br> console.log(chopper.format('{0} - {1} - {2}', 12, 24, 25)); // outputs "12 - 24 - 25"<br> </script>

The following is a complete code that can be copied into your own project.

Copy code The code is as follows: