daily pastebin goal
39%
SHARE
TWEET

Untitled

a guest Jan 19th, 2018 48 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function DNAtranscribe(strand1) {
  2.   let strand = strand1.split("");
  3.   var newStrand = [];
  4.   for (var i = 0; i < strand.length; i++) {
  5.  
  6.     if (strand[i] === "A") {
  7.       newStrand.push("U");
  8.     }
  9.     else if (strand[i] === "C") {
  10.       newStrand.push("G");
  11.      
  12.     }
  13.     else if (strand[i] === "G") {
  14.       newStrand.push("C");
  15.     }
  16.     else if (strand[i] === "T") {
  17.       newStrand.push("A");
  18.     }
  19.     else if (strand[i] !== "A"|| strand[i] !== "C" || strand[i] !== "G" || strand[i] !== "T") {
  20.       return "Invalid Input"
  21.     }
  22.  
  23.   }
  24.   return newStrand.join("");
  25. }
  26.  
  27. console.log(DNAtranscribe("ACGXX"));
RAW Paste Data
Top