42 users online (0 members and 42 guests)  


  Results 1 to 2 of 2

Related

  1. test    Forum: HTML Forum
    Replies: 1
  1. #1
    Croft009's Avatar
    New User

    Status
    Offline
    Join Date
    Sep 2008
    Posts
    2

    Unhappy Find a value and test

    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)');

    }
    What am I doing wrong????

  2. #2
    Croft009's Avatar
    New User

    Status
    Offline
    Join Date
    Sep 2008
    Posts
    2

    Re: Find a value and test

    Hi

    Don't need it anymore. Thanks



Tags for this Thread