Hi folks ! Here is my solution until point 8.
Your comments are welcomed
Hello friends!
Review my code about this challenge project, Iโd be happy to know if you have some feedback for me Check my Gist.
Bye bye world!.
here is my soultion to the mutate problem, what you want to do is create 4 if statements or a switch statement for each case, and generate a replacement for the chosen strand to mutate, via math.floor(math.random() * 3)), inside a for loop that runs 15 times. let me just paste my code.
mutate () {
let newDna = ;
for (let i = 0; i < 15; i++) {
const dnaBases = ['A', 'T', 'C', 'G'];
let baseToEdit = dnaBases[Math.floor(Math.random() * 4)];
let availableBases;
let newBase;
if (baseToEdit === 'A') {
availableBases = ['T', 'C', 'G'];
newBase = availableBases[Math.floor(Math.random() * 3)];
};
if (baseToEdit === 'T') {
availableBases = ['A', 'C', 'G'];
newBase = availableBases[Math.floor(Math.random() * 3)];
};
if (baseToEdit === 'C') {
availableBases = ['T', 'A', 'G'];
newBase = availableBases[Math.floor(Math.random() * 3)];
};
if (baseToEdit === 'G') {
availableBases = ['T', 'C', 'A'];
newBase = availableBases[Math.floor(Math.random() * 3)];
};
newDna.push(newBase);
}
return newDna;
}
here is my take on this challenge, this was definitely a difficult challenge. It took me 3 days to complete. I am looking forward to your feedback.
Poorly formulated question. Guys(Codecademy)- you should provide an example/sample data set of what the input and output of a function should be. Confusing mutate() problem is not clear.
#1 . Are we just changing 1 random base in a 15 base strand? If so, specimen #1 and specimen #2 have 25% DNA in common
will always be true ; Exactly how many random bases in a 15base strand are we supposed to change?
#2. specimen #1 = any unique mockUpStrand() and specimen#2 = the one obtained from mutate() function?
#3 " For example, if the randomly selected base is the 1st base and it is 'A'
, the base must be changed to 'T'
, 'C'
, or 'G'
. But it cannot be **'A'
again*."* what do you mean? for this example 'A cannot appear more than once in a 15 base strand --OR-- if โAโ is found in index 7 than โAโ cannot exist in any location 7 thru 15??? clear explanation needed
Hi here is my solution