Use only size*size items for bingo
This commit is contained in:
		| @@ -6,10 +6,11 @@ interface Props{ | |||||||
| } | } | ||||||
|  |  | ||||||
| export default function Bingo({size, items}: Props){ | export default function Bingo({size, items}: Props){ | ||||||
|  | 	const activeItems: string[] = items.slice(0, size*size); | ||||||
| 	let rows: string[][] = []; | 	let rows: string[][] = []; | ||||||
| 	for(let i = 0; i < (items.length / size); i++) | 	for(let i = 0; i < (activeItems.length / size); i++) | ||||||
| 	{ | 	{ | ||||||
| 		rows[i] = items.slice(i * size, (i + 1) * size); | 		rows[i] = activeItems.slice(i * size, (i + 1) * size); | ||||||
| 	} | 	} | ||||||
| 	return( | 	return( | ||||||
| 		<table className='w-1/2 table bg-primary text-primary-content m-auto'> | 		<table className='w-1/2 table bg-primary text-primary-content m-auto'> | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user