You are not creating the array correctly, and your for loop is going out of bounds Here's what it should look like var actor = 20,30,10,30,10, 10,20,40,30,0, 10,10,20,40,20 var n1 = 0; for (var I = 0; I.
You are not creating the array correctly, and your for loop is going out of bounds. Here's what it should look like. Var actor = 20,30,10,30,10, 10,20,40,30,0, 10,10,20,40,20 var n1 = 0; for (var I = 0; I You can change n1 = n1 + actor0i; to n1 += actor0i;.
You might also consider changing for (var I = 0; I.
Thank you! Works perfectly. MY life would be so much easier if I could supply a csv file to Javascript – user991735 Nov 1 at 15:23.
Remember array indicies are 0-based. The array actor0 has 5 elements (0-4), but you're iterating over 6 (0-5). When you try to add actor05—which is undefined—to n1, it becomes NaN, because you can't add undefined to a Number.
Instead of hard-coding the array length, use its length property: for (var I = 0; I.
Thank you! That worked, It was bit of a noob mistake! Maybe I need some sleep.
– user991735 Nov 1 at 14:19.
When using the Array constructor, you use parentheses: var actor = new Array( ... ); You can also use the literal array syntax for the outer array, just as you do with the inner arrays: var actor = ... ; You are looping outside the array. As the array has five items, you should loop from 0 to 4: for (var I = 0; I As you have 5 items, you do the comparison I.
You only have a 3 x 5 matrix, if you want to call it this, so you are exceeding the dimension count. Try being dynamic and replace 6 with the value you are really looking for: var actor = new Array 20,30,10,30,10, 10,20,40,30,0, 10,10,20,40,20 var n1 = 0; for (var I = 0; I.
Here is a jsfiddle to do what you need. jsfiddle.net/LuQCD/ It abstracts your sum logic into a function so you can pass in any row of the 2d array you want to get the sum of that row.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.