JavaScript (Exercice Loop)
JavaScript (Exercice Loop)
Function `printArray()` prints all the elements of a 2D array using nested for
loops.
function printArray(arr) {
[3, 4],
[5, 6]];
printArray(arr) //1 2 3 4 5 6
Exercice 2
Exercice 3
Write a JS code to find the power of a number using for loop
function numPower(num,pow) {
console.log(numPower(4,3)); //64
console.log(numPower(16,2)); //256
function printPattern(range) {
printPatter(8);
/* 1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
1 2 3 4 5 6
1 2 3 4 5 6 7
1 2 3 4 5 6 7 8 */