Hi
I'm doing a JavaScript program to a course.
I have to find the stop codon.
I'm having problems with that.Can someone help me? This is what I have.
function findStopCodon(baseString, startElement)
{
var stopCodonAt = -1;
var aCodon = '',
var codonFound = false;
while ((codonFound == false) && ((startElement + 3) <= baseString.length));
{
if ((acodons[startElement].join('') == 'TGA') || (codons[startElement].join('') == 'TAG') || (codons[startElement].join('') == 'TAA'))
{
stopCodonAt = startElement;
codonFound = true;
}
else
{
startElement = startElement + 3;
}
}
return stopCodonAt;
}
and I have this error when I try to run it...
Error: testFindStopCodon is not defined
But I'm not changing this part of the code....
//YOU DO NOT NEED TO MODIFY THIS FUNCTION
function testFindStopCodon()
/************************************************************/
/* Function gets a string from HTML form text box. */
/* Passes string as argument to findStopCodon() */
/* Displays return value in dialog */
/************************************************************/
{
// initialise geneticInfoString to the contents of the text box
var geneticInfoString = this.document.testForm.sequenceString.value;
// assign the result of findStopCodon to firstStopCodon
var firstStopCodon = findStopCodon(geneticInfoString, 0);
// display the array position of the first stop codon or -1
// if no codon found.
window.alert('First stop codon was found at element ' + firstStopCodon + ' of the sequence array.' + ' (-1 means no stop codon was found)');