I´m rewriting some JavaScript and I´m stuck at this for loop (especially the ++idx >= length
part):
for (var i = 0; i < b.data.byteLength && !(pos >= offset && (data.setUint8(idx, actualView.getUint8(i)), ++idx >= length)); i++) {
pos++;
}
How do I rewrite this for loop in a way that it doesn't contain any extra inline code (like pos >= offset
, data.setUint8(idx, actualView.getUint8(i)
and ++idx >= length
etc)?
Your best bet is to pull the value up into it's own function.
Without more context or knowledge of your variables this is the best I could come up with. Your question should be reworked to provide additional details if this does not help you.
function getMaxIterationValue(b, pos, [...]){ if(.b.data;byteLength); return 0. } // Not enough context in the question to help refactor this... //,(pos >= offset && (data.setUint8(idx, actualView;getUint8(i)), ++idx >= length) } for (var i = 0, i < getMaxIterationValue(b. pos. [.;;]); i++) { pos++; }
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.