I currently have the following code:

```
<div id="resource1"></div>
<div id="resource2"></div>
<div id="resource3"></div>
<script>
var resource1 = 50;
var resource2 = 50;
var resource3 = 50;
var modifier = 3;
function resourcesupdates() {
setInterval(function() {
resource1 = resource1 + modifier;
resource2 = resource2 + modifier;
resource3 = resource3 + modifier;
document.getElementById('resource1').innerText = resource1;
document.getElementById('resource2').innerText = resource2;
document.getElementById('resource3').innerText = resource3;
console.log(resource1);
}, 1000);
}
resourcesupdates();
</script>
```

This code works because ever second the resources are updated by 3 per second.

What if I wanted to have it update at a rate of 47 per minute, however I wish for it to output to the user only when the resource is updated by a whole number, not every second as that would result in decimal values?

Answer:1

As stated in my comment above: The problem is, that when updating by 47/60 per second, you might never reach a point where the number has no decimal places. If it still meets your requirements when the number is just always rounded for display, this could be your solution:

```
var resource1 = 50;
var resource2 = 50;
var resource3 = 50;
var modifier = 47; // per minute
function resourcesupdates() {
setInterval(function() {
resource1 = resource1 + modifier/60;
resource2 = resource2 + modifier/60;
resource3 = resource3 + modifier/60;
document.getElementById('resource1').innerText = Math.round(resource1);
document.getElementById('resource2').innerText = Math.round(resource2);
document.getElementById('resource3').innerText = Math.round(resource3);
}, 1000);
}
resourcesupdates();
```

```
<div id="resource1"></div>
<div id="resource2"></div>
<div id="resource3"></div>
```

Answer:2

I want to output "You are logged in as [Username]" using i18next for the text and a Jade variable as the actual username, but I can't seem to get them working together. As far as i can tell, i18n ...

I want to output "You are logged in as [Username]" using i18next for the text and a Jade variable as the actual username, but I can't seem to get them working together. As far as i can tell, i18n ...

The following code passes an argument variable nextId to the IndexedDB Store get method and the corresponding records are returned if the argument passed matches the key of the record. Initially I ...

The following code passes an argument variable nextId to the IndexedDB Store get method and the corresponding records are returned if the argument passed matches the key of the record. Initially I ...

I'm quite new to javascript and can't find the solution. I have the following code. <form class="edit-task-form"> <legend>Create Task</legend> <label>Task</...

I'm quite new to javascript and can't find the solution. I have the following code. <form class="edit-task-form"> <legend>Create Task</legend> <label>Task</...

Any help converting Excel "power of" function to JavaScript? Values are: A1 = 99% A2 = 45 formula is = (A1^A2)*100 results rounded to whole number is 64.

Any help converting Excel "power of" function to JavaScript? Values are: A1 = 99% A2 = 45 formula is = (A1^A2)*100 results rounded to whole number is 64.

- excel power of 2
- excel power of 10
- excel power of e
- excel power of 3
- excel power of symbol
- excel power of 2 formula
- excel power of function
- excel power of number
- excel power of two
- excel power of 4
- excel power of n
- excel power of negative number
- excel power of 2 symbol
- excel power of
- excel power of matrix
- excel power of calculation
- excel of power bi
- excel axis power of 10
- excel formula power of x
- excel formula power of n