Can sb explain step by step the following code

const rectangle = function(width, height, character){ 
	
	return times(height, function(){return line(width, character);});
};
const line = function(width, character){
	let karakter = function(){return character;};
	return times(width, karakter).join(""); 
};
                            
const times = function(height, funksion){ 
	const result = new Array(height);
	for (let i = 0; i < height; i += 1){
		result[i] = funksion();
        }
	return result;
};
console.log(rectangle(10, 10, "*"));

Please Tell us what’s happening in your own words.

Learning to describe problems is hard, but it is an important part of learning how to code.

Also, the more you say, the more we can help!

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.