Help with Challenge 3


Hey! I need some help with the third challenge. I have tried so many solutions, but when I run the code, it fails every time.
This is my code:

const countRows = () => {
		return GRID.length;
	const countColumns = () => {
		return GRID[1].length;
	const gridSize = () => {
		return `"${countRows().toString()} x ${countColumns().toString()}"`;

Not sure what I’m doing wrong. Can anyone help me? Thanks! :slight_smile:


Hey, the question asks us to write just the function so you don’t need to call all 3 at the end. Also, you can make the return of gridSize() easier by using concatenation. e.g widthvalue + " x " + rowvalue. Hope that helps.


@TizzleLizzle Thanks! Do we have to place parameters (rows, cols) in the gridSize function? When you call gridSize(), is it expecting arguments (which would be the countRows and countColumns functions?


Nevermind, I solved it! Thanks for your help @TizzleLizzle


That’s great. Glad I could help.


Why isn’t this working?

return countRows().toString() + " x " + countColumns().toString();


Hey, I don’t know if this is too late but you don’t need the toString()'s .Since you’re already concatenating, you can combine different data types with a +. And don’t forget to wrap what you’re returning in parenthesis.


Alright I did this but it’s not working:
return {countRows() + " x " + countColumns()};


You’re almost there! Do you want to return column x width or width x column?

Edit: sorry I meant to say height instead of column.


Oh man, okay, thanks!