I'm trying to create a array
of Strings
and give a value to each of the elements. Then calculate the length of each String
and multiply each one by the previous multiplication. But it does not work.
<h2> DEMO </h2>
<p id="demo"></p>
<script type="text/javascript">
var s,x=1;
var txt="";
String [] d = {"1X", "1", "X2", "1X2", "1", "1X", "X2", "1", "1X2", "1", "2", "1X", "X2", "2"};
Int [] e = [14];
for (s=0;s<=13;s++){
e[s]=(d[s].length);
x=x*e[s];
txt = s + " " + d[s] + " " + x + "<br>";
}
document.getElementById("demo").innerHTML = txt;
</script>