Hi when i put the code CTGATGACATAGACA in , Why does my alert box say start codon not found insted of postion 3.
This is the code i am working to
function findStartCodon(someBases, startingPlace) {
var startCodonAt = -1;
var aCodon = ”;
var codonFound = false;
while ((codonFound == false) && ((startingPlace + 3) <= someBases.length)) {
aCodon = someBases.substring(startingPlace, startingPlace + 3);
if (aCodon == ‘ATG’) {
startCodonAt = startingPlace;
codonFound = true;
} else {
startingPlace = startingPlace + 3;
}
}
return (startCodonAt);
}
function testFindStartCodon() {
var startCodonAt = -1;
var someGeneticInfo = this.document.testForm.sequenceString.value;
startCodonAt = findStartCodon(someGeneticInfo);
if (startCodonAt != -1) {
window.alert(“The beginning of the start codon is at position ” + startCodonAt + “.”);
}else {
window.alert (“The start codon was not found in this sequence.”);
}
}
Would be gratefull of any help
Daz