We would like to know how to find out if a String contains a character and store values in 2 separate variables.
<!DOCTYPE html>
<html>
<head>
<script type='text/javascript'>
var ar = ["A:2", "B:3", "C:2", "D:1", "E:2"];
for(var i = 0; i< ar.length; i ++){
temp = ar[i].split(':');
console.log('first='+temp[0]+' second='+temp[1])
}<!-- w w w .j a va 2 s.c o m-->
</script>
</head>
<body>
</body>
</html>
The code above is rendered as follows: