Last active
November 1, 2018 13:19
-
-
Save codetricity/7af69bcdf206ff6c3caf855b3ffbf6fd to your computer and use it in GitHub Desktop.
d3 rainfall lessons
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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