pa mmj portal code example
Example 1: pa mmj portal
function reverseString(input)
{
var output = "";
for(var i = input.length - 1; i >= 0; i--) {
output += input[i];
}
return output;
}
Example 2: pa mmj portal
function average(nums) {
return nums.reduce((a, b) => (a + b)) / nums.length;
}
Example 3: pa mmj portal
let count = 10000;
console.time('Total time')
for (let i = 0; i < count; ++i) {
setTimeout(() => {
if (--count === 0) {
console.timeEnd('Total time')
}
}, i / 10); // Set 10 timeouts for each millisecond
}