【发布时间】:2020-04-28 00:57:51
【问题描述】:
https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/dna-pairing 当我访问一个键时,我想要它的值并将其设置为数组。我尝试访问的方式是使用字符串。例如:GCG。因此,我想得到 p>
[["G", "C"], ["C","G"],["G", "C"]]
我该怎么做?
function pairElement(str) {
let dna = {
"A": "T",
"C": "G",
"T": "A",
"G": "C"
}
}
pairElement("GCG");
【问题讨论】:
-
坚持下去,坚持下去。
标签: javascript arrays json object