As a novice, I am attempting to code a function that will change values within an array. Specifically, my goal is to convert ºC to ºK. However, the current code I have written is not functioning correctly and is throwing an error message stating "j is undefined". What could be causing this issue?
//Initial Arrays
var I_t1 = new Array();
var V_t1 = new Array();
//Arrays for Table 1
var K_t1 = new Array();
var P_t1 = new Array();
function kelvin() {
var i;
var j = new Array();
var k = new Array();
var k;
var j = V_t1.lenght;
var k = I_t1.lenght; // The k variable will be set to the length of array T
for(i=0; i < j.length; i++){
K_t1[i] = (V_t1[i] * 200);
}
for(i=0; i < k.length; i++){
P_t1[i] = (I_t1[i] * 400);
}
}
That's the current state of the code. My main question troubles on how to adjust this function to accomplish its intended purpose.
-What modifications should I make to ensure this function works as intended?