Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

322
Views
How to change every specific value in an array to another value? (Javascript)

How can I change every specific value within an array to another specific value? My function splits a string into an array, and if a specific index == "T" it's supposed to change that value to "U", join the values in the array, and return the result. But the value "T" isn't changing within the array as I loop through it. What am I doing wrong?

function DNAtoRNA(dna) {

let array = dna.split();
let rna = "";

for(var i = 0; i < array.length; i++) {
  if(array[i] == 'T') {
    a[i] = 'U';
  }
  }
rna = array.join();
return rna;
}

Example input = "ATFT", output = "AUFU"

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!