In theory, it would be acceptable. In practice, I was inclined to do as many repetitive jobs on the server as possible. If you think about it, from the point of view of which it can be done faster, you KNOW how quickly your server can do it. Resources remain (relatively) constant.
The execution of this in javascript depends on the client environment. Using a web application, the client environment is infinitely diverse. You never know how much memory the client will have available, so it is impossible to assess how effectively they can analyze data. 99% of your customers may be fine, but the other 1% get a blocked browser when using your script.
The safest bet should always use known amounts as much as possible. In this case, this is your known amount - do the work there.
source share