pushing into arrays in javascript -


my script (is meant to) grab text page (which works fine) , splits by newline (\n) , puts each splitted string array called "dnasequence"; there loops through each element in array , if string contains character ">" assigns string "var header_name", else pushes other lines new array called "dnasubseq". original text looks this:

>header_1 gctagctagc cgcgagcgagc >header_2 gcgcatgcgac 

when execute code fails alert on anything. here code:

function loadermy() {  var dnasubseq = []; var dnasequence = []; var header_name = ""; var splittedlines = document.getelementbyid("page-wrapper").innertext; dnasequence = splittedlines.split('\n');  (var = 0; < dnasequence.length; i++) {     if (dnasequence[i].match(/>/)) {         header_name = dnasequence[i];         alert(header_name);     }     else {         dnasubseq.pushvalues(dnasequence[i]);     }     alert(dnasubseq); } } 

change

dnasubseq.pushvalues(dnasequence[i]); 

to

dnasubseq.push(dnasequence[i]); 

Comments

Popular posts from this blog

qt - Using float or double for own QML classes -

Create Outlook appointment via C# .Net -

ios - Swift Array Resetting Itself -