<!DOCTYPE html> <html> <body> <h1>JavaScript Strings</h1> <h2>The split() Method</h2> <p>split() splits a string into an array of substrings, and returns the array:</p> <p id="demo"></p> <script> let text = " 0.00 "; const myArray = text.trim().split("."); document.getElementById("demo").innerHTML = myArray[1]; </script> </body> </html>
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter