function calculatePercentage (datasets){
	// sum of the datasets
	let total = 0; 
	// calculate the sum of datasets
	for (var i = 0; i < datasets.length; i++) {
		// sum
		total += datasets[i];
	}
	// calculate percentage of datasets
	for (var i = 0; i < datasets.length; i++) {
		datasets[i] = Math.floor(datasets[i] / total * 100);
	}
	return datasets;
}
// Calculate the percentage of the datasets
Calculate the percentage of the datasets
Calculate the percentage of the datasets
function calculatePercentage (datasets){
	let total = 0; 
	for (var i = 0; i < datasets.length; i++) {
		total += datasets[i];
	}
	for (var i = 0; i < datasets.length; i++) {
		datasets[i] = Math.floor(datasets[i] / total * 100);
	}
	return datasets;
}
function calculatePercentage ( datasets ) { let total = 0 ; for ( var i = 0 ; i < datasets . length ; i ++ ) { total += datasets [ i ] ; } for ( var i = 0 ; i < datasets . length ; i ++ ) { datasets [ i ] = Math . floor ( datasets [ i ] / total * 100 ) ; } return datasets ; }
Calculate the percentage of the datasets
Calculate the percentage of the datasets
// sum of the datasets // calculate the sum of datasets // sum // calculate percentage of datasets