Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

made loop variables local

  • Loading branch information...
commit 4402be71921a01b0b2a0fa83275e3d7930a3e39c 1 parent f9e782c
Lukas Domagala Cyrik authored
6 exercises/division_1_5.html
View
@@ -7,7 +7,7 @@
function createEasyDividend(n,size){
var result = 0;
var maxDividend = Math.floor(9/n);
- for(i=0;i<size;i++){
+ for( var i=0;i<size;i++){
var digit= 0;
if(i==size-1){digit=n*KhanUtil.randRange(1,maxDividend)}
else{digit=n*KhanUtil.randRange(0,maxDividend)}
@@ -20,9 +20,9 @@
var divisions= [];
var subtrahends = [];
var minuends = [];
- for(i=temp.length-1;i>=0;i--){
+ for( var i=temp.length-1;i>=0;i--){
var curDividend = 0;
- for(y=i;y<temp.length;y++){
+ for( var y=i;y<temp.length;y++){
curDividend+=temp[y]*Math.pow(10,y-i);
}
if(curDividend>=div || divisions.length > 0){
4 exercises/division_2.htm
View
@@ -9,9 +9,9 @@
var divisions= [];
var subtrahends = [];
var minuends = [];
- for(i=temp.length-1;i>=0;i--){
+ for( var i=temp.length-1;i>=0;i--){
var curDividend = 0;
- for(y=i;y<temp.length;y++){
+ for( var y=i;y<temp.length;y++){
curDividend+=temp[y]*Math.pow(10,y-i);
}
if(curDividend>=div || divisions.length > 0){
4 exercises/division_3.html
View
@@ -9,9 +9,9 @@
var divisions= [];
var subtrahends = [];
var minuends = [];
- for(i=temp.length-1;i>=0;i--){
+ for( var i=temp.length-1;i>=0;i--){
var curDividend = 0;
- for(y=i;y<temp.length;y++){
+ for( var y=i;y<temp.length;y++){
curDividend+=temp[y]*Math.pow(10,y-i);
}
if(curDividend>=div || divisions.length > 0){
4 exercises/division_4.html
View
@@ -9,9 +9,9 @@
var divisions= [];
var subtrahends = [];
var minuends = [];
- for(i=temp.length-1;i>=0;i--){
+ for( var i=temp.length-1;i>=0;i--){
var curDividend = 0;
- for(y=i;y<temp.length;y++){
+ for( var y=i;y<temp.length;y++){
curDividend+=temp[y]*Math.pow(10,y-i);
}
if(curDividend>=div || divisions.length > 0){
4 exercises/multiplication_3.html
View
@@ -62,10 +62,10 @@
<p data-if="CARRY[1]"><var>A_ARRAY[1]</var> * <var>B_ARRAY[0]</var> + <var>CARRY[1]</var> = <var>A_ARRAY[1] * B_ARRAY[0] + CARRY[1]</var></p>
<p data-else><var>A_ARRAY[1]</var> * <var>B_ARRAY[0]</var> + <var>CARRY[1]</var> = <var>A_ARRAY[1] * B_ARRAY[0]</var></p>
<p data-if="CARRY[2]">carry = <var>CARRY[2]</var></p>
- <p data-else>Write <var>DIGITS[2]</var> as the digit</p>
+ <p>Write <var>DIGITS[1]</var> as the digit</p>
<p data-if="CARRY[2]"><var>A_ARRAY[2]</var> * <var>B_ARRAY[0]</var> + <var>CARRY[2]</var> = <var>A_ARRAY[2] * B_ARRAY[0] + CARRY[2]</var></p>
<p data-else><var>A_ARRAY[2]</var> * <var>B_ARRAY[0]</var> + <var>CARRY[2]</var> = <var>A_ARRAY[2] * B_ARRAY[0]</var></p>
- <p>Write <var>DIGITS[3]</var><var>DIGITS[4]</var> as the digit</p>
+ <p>Write <var>DIGITS[3]</var><var>DIGITS[2]</var> as the digit</p>
</div>
</div>
</body>
6 exercises/subtracting_decimals.html
View
@@ -8,7 +8,7 @@
var table = a.slice();
var borrow = new Array( a.length );
initArray( borrow, 0);
- for( i = 0; i < a.length; i++){
+ for( var i = 0; i < a.length; i++){
if(a[i] < b[i] || a[i] < 0){
table[i+1] -= 1;
table[i] +=10;
@@ -16,7 +16,7 @@
}
}
var result = 0;
- for(i = 0; i < a.length; i++){
+ for( var i = 0; i < a.length; i++){
if(b[i]){
result += (a[i] - b[i]) * Math.pow(10,i);
}
@@ -27,7 +27,7 @@
return { borrow: borrow, result: result};
}
function initArray( arr, val){
- for(i = 0; i < arr.length; i++){
+ for( var i = 0; i < arr.length; i++){
arr[i] = val;
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.