Javascript examples for Array Operation:Array Element
split and get selection data from an array
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> window.onload=function(){// w w w. j a v a2s. c om var a = ["a","b","c",1,2,3,'asdf',8,9,78,6]; var stringCount = 0; for (var i = 0; i < a.length; i++){ if (typeof a[i] === 'string'){ stringCount++; } } document.getElementById('test').innerHTML = "the number of strings is: " + stringCount; } </script> </head> <body> <p id="test"> test </p> </body> </html>