Javascript examples for RegExp:RegExp Match
Count instances of string in an array using regex
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> window.onload=function(){/*from w w w .j a v a2s . c om*/ var numOfTrue = 0; var Answers = [ "true", "false", "false", "true", "false" ]; console.log(Answers.toString().match(/true/g).length); } </script> </head> <body> </body> </html>