Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //15 EXERCISE: FUNCTIONS/More Exercise/05. Print DNA.js
- printDna0(14)
- function printDna0(n) {
- 'use strict'
- const seq = 'ATCGTTAGGG'
- const temp = ['**AB**', '*A--B*', 'A----B', '*A--B*']
- let i = 0
- let j = 0
- let k = 0
- while (j !== n) {
- let ch1 = seq[i]
- let ch2 = seq[i + 1]
- let str = temp[k].replace('A', ch1)
- str = str.replace('B', ch2)
- console.log(str)
- j++
- i += 2
- if (i === 10)
- i = 0
- k++
- if (k === 4)
- k = 0
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement