Skip to content

Instantly share code, notes, and snippets.

@Samuelpasaribu
Created November 17, 2021 08:26
<!DOCTYPE html>
<html>
<head>
<title>Hitung huruf kapital dalam JavaScript</title>
</head>
<body>
Enter some text: <br>
<input type="text" id="textbox">
<button onclick="count()">
<br>
<script type="text/javascript">
function count(){
var mytext= document.getElementById("textbox").value;
var numUpper = (mytext.match(/[A-Z]/g) || []).length;
alert(numUpper);
}
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment