Created
January 29, 2019 19:43
-
-
Save sreubenstone/b715ccfd96cb637af4258cb1a72f805a to your computer and use it in GitHub Desktop.
regex-sr
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
const string = '4%4%15%30%33%' | |
const fixed = string.replace(/%/g, ' '); | |
console.log(fixed) | |
const array = fixed.split(' ') | |
console.log(array) | |
array.forEach(element => { | |
const integer = parseInt(element, 10); | |
if (integer % 4 === 0) { console.log(`${integer} divisible by four`) } | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment