Javascript examples for String:indexOf
get indexes for splitted string
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> </head> <body> <script type="text/javascript"> var str = "The quick brown fox jumps over the lazy dog."; var arr = str.split(' '); for( var i = 0, len = arr.length; i < len; i++ ) { arr[i] = str.indexOf( arr[i] ); } document.write( arr );//from w w w . j a v a 2s . c om </script> </body> </html>