Skip to content

Commit 94ea13c

Browse files
author
Kevin Nadro
committed
fixed strings with the array
1 parent 6e282b6 commit 94ea13c

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

js/create/array2d.js

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,15 +64,27 @@ const generateJS = (logger, tracer, tracerName) => {
6464
var i;
6565
var j;
6666
var comma = ',';
67+
var currVal;
68+
var nors;
6769
for(i = 0; i < numRows; i++){
6870
if(numRows > 1){
6971
line = '[';
7072
}
7173
for(j = 0; j < numColumns-1; j++){
72-
line += table.childNodes[i].childNodes[j].childNodes[0].value + ',';
74+
currVal = table.childNodes[i].childNodes[j].childNodes[0].value;
75+
nors = Number(currVal);
76+
if(isNaN(nors)){
77+
currVal = "'" + currVal + "'";
78+
}
79+
line += currVal + ',';
7380
}
7481
if(i === numRows - 1){comma = '';}
75-
line += table.childNodes[i].childNodes[j++].childNodes[0].value + ']' + comma;
82+
currVal = table.childNodes[i].childNodes[j++].childNodes[0].value;
83+
nors = Number(currVal);
84+
if(isNaN(nors)){
85+
currVal = "'" + currVal + "'";
86+
}
87+
line += currVal + ']' + comma;
7688
logger.print(line);
7789
}
7890
if(numRows > 1){

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy