Javascript examples for String:substring
Get sub string from a string
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> window.onload=function(){//from w w w. ja v a2 s . co m var myStr = 'cocacola'; var strHalf = myStr.length / 2; var array = [myStr.substr(0, strHalf),myStr.substr(strHalf, myStr.length)]; console.log(array); } </script> </head> <body> </body> </html>