'im trying to display some code into a text area, i got it to work i just dont know how to get it to display my values JAVASCRIPT
// i have this right now, im trying to figure out how i could print the values into a text area
onEvent("factorsof2", "click", function( ) { ``` var num = calculate();
function calculate(num) {
```
var half = Math.floor(num / 2),
```
str = '1',
```
i, j;
num % 2 === 0 ? (i = 2, j = 1) : (i = 3, j = 2);
```
for (i; i <= half; i += j) {
num % i === 0 ? str += ',' + i : false;
}
str += ',' + num;
}
setText("text_area3", "Your factors are: " + calculate(num));
});
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
