How to send a specific array element?

Hello. Dan code. (jsfiddle.net/lega911/nw8fy9y0/)


<div al-app="main">

 <div al-repeat="i in count">
 <input type="text" al-value="result[$index]">
</div>
 <button @click="count++">+</button>

<hr>
 {{result | json}}
 <form name="new" onclick="lod(result)">
 <button type="submit" class="btn btn-danger">send</button>
</form>

</div>

<script src="alight_0.12.last.min.js"></script>
the <script>
 function main(scope) {
 scope.count = 1;
 scope.result = [];
 scope.load = function () {
console.log(scope.result);
}
}
</script>

the <script>function lod(result) {
document.write(result);
}</script>


Need in functions lod to display only the even elements of the result. Please tell me how can I do that?
July 4th 19 at 23:24
1 answer
July 4th 19 at 23:26
codepen.io/anon/pen/ALXmLa?editors=1012
The loop writes to a new array each even-numbered element.
The problem is not that I can't write an algorithm. The problem is that in my code, result doesn't work as it should work the array. - Oceane57 commented on July 4th 19 at 23:29
: document.write(result); -> document.write(result[0]); - mateo commented on July 4th 19 at 23:32
: This is not working in this code. - Oceane57 commented on July 4th 19 at 23:35
in my foam works, then the error is elsewhere. codepen.io/anon/pen/ALXmLa?editors=1011 - mateo commented on July 4th 19 at 23:38
About where can byit error in my code? - Oceane57 commented on July 4th 19 at 23:41

Find more questions by tags JavaScriptHTML