Last active
April 18, 2017 10:41
-
-
Save klockey/d77a5038b819f84b54393311941a881a to your computer and use it in GitHub Desktop.
Experience with Javascript
This file contains 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
We first started out with CSS and Html. I learned the rules of both but I think I didn't have a concise method of doing either so | |
I was just slapping code together and seeing if it would work. This last weekend when I worked on my portfolio, I noticed that I was | |
taking a more measured approached to both of these languages. I feel more confident about them now. As far as Javascript is | |
concerned, I felt more comfortable because it is more of a procedural language which I am more comfortable with. React has | |
a big learning curve and I feel I am starting to make real improvements in it. My goal is to write React code with very little help. | |
https://www.codewars.com/users/krock/completed_solutions | |
function invert(array) { | |
if (array.length === 0){ | |
return array | |
} | |
z = array.map(function (a) { | |
if (a === 0) { | |
return 0 | |
} else { | |
return -a | |
} | |
}) | |
return z | |
} | |
function stringClean(s) { | |
z = [] | |
z = s.split("") | |
z = z.map( (a) => { | |
if ((parseInt(a)) || (parseInt(a) === 0)){ | |
return '' | |
} else if (a === ','){ | |
return 'comma' | |
} else { | |
return a | |
} }) | |
let a = z.toString().replace(/,/g, '') | |
return a.toString().replace(/comma/g, ',') | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment