JSFiddle - React, Tailwind, and code Playground

by btipling

JavaScript

// write a function growNumber, take two parameters num, howManyLoops
// it's going to go over a for loop for what the value of howManyLoops
// is. In the loop we will add num by itself.

function growNumber(num, howManyLoops){
	var result = 0;
	for (var i = 0; i < howManyLoops; i = i + 1){
  	result = result + num;
  }
  return result;
}

var res1 = growNumber(2, 5);

console.log('2 * 5 is: ' + res1);

var res2 = growNumber(2, 3);

console.log('2 * 3 is: ' + res2);