Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
d3 rainfall lessons
d3.csv('data/rainfall-by-state.csv').then(data => {
data.forEach(stateData => {
stateData.rainfall = +stateData.rainfall;
const checkChar = /^[A-Z]/;
for (let i = 0; i < 5; i++) {
if (checkChar.test(stateData.state)) {
console.log('found capital letter');
break;
} else {
stateData.state = stateData.state.substring(1);
}
}
});
console.log(data);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.