Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <button>test</button>
- var h = [2, 4, 6, 3, 4, 2, 7];
- var button = document.getElementsByTagName('button');
- var placementOfValueReaches5 = [];
- h.forEach(function(value, index){
- if (value >= 5){
- button[index].setAttribute('disabled', true);
- placementOfValueReaches5.push(index);
- }
- });
- console.log(placementOfValueReaches5); // outputs [2, 6]
Add Comment
Please, Sign In to add comment