+ 1
Why this doesn’t work?
https://code.sololearn.com/WtZXFx339BAt/?ref=app The idea of the code is that when a DNA chain is introduced the code returns another DNA chain (this part works), then the result must be converted to RNA, the error says that the variable b.lenght is undefined, I tried with inner .HTML and textContent but it didn't work
4 Antworten
+ 3
What should the code do ? The description is there for a reason, try to use it next time please. We need more info about what the code is doing, and where the mistake is.
+ 1
in short it says you did not define b.length in the project but you did define b as a.value
+ 1
Marco Herrera
Your problem is with line 27 b = a.value. The attribute "value" for which you are trying to get in line 27 is not a (standard) attribute for the <p> tag. Hence there is no value attribute so the variable "b" is undefined.
HTML value Attribute: https://www.w3schools.com/tags/att_value.asp
HTML DOM innerText Property: https://www.w3schools.com/jsref/prop_node_innertext.asp
So we are the same page b.innerText or b.textContext will not work because b is not an HTML object. Instead, you should get the text from the variable "a", a.innerText or a.textContent.
Using a.textContent or a.innerText yield the same results, it appears the final output is a little extra.
final output: "New DNA section: TGGGACCGTUACCCUGGCA"
I assume that is not what you are looking for.
https://code.sololearn.com/WgGB7R6x04cd/#js