One of the new members of the FCC Austin group, Tyler, is starting a web dev house in Austin. That's pretty cool, I hope it takes off, and I may join it myself after I finish the Intermediate Front End Projects, if I feel I could benefit a lot from the camaraderie and mentorship. At the moment, I'm super busy with coding, and I don't want to spend time and funds moving to a new place, plus, I like my gigantic bedroom and living in my own home.
But, we'll see, I'll play it by ear for now.
Good stuff. :)
Okay, today I'll continue with "Missing Letter." This one's tough, I'm still trying to figure out how to go at this one.
I've got this so far (it works for the first two scenarios):
But I'm still messing with the code. Saving it here, though.
function fearNotLetter(str) {
var strArray = str.split('');
var unicodeArray = [];
var previousLetterCharCode;
var currentLetterCharCode;
for (var i = 0; i < strArray.length; i++) {
unicodeArray.push(strArray[i].charCodeAt(0));
}
var counter = 0;
var comparisonArray = [];
for (var j = 0; j < unicodeArray.length; j++) {
if (unicodeArray[j] + 1 !== unicodeArray[(j+1)]) {
var unicodeForMissingLetter = unicodeArray[(j + 1)];
var convertedMissingLetter = String.fromCharCode((unicodeForMissingLetter - 1));
return convertedMissingLetter;
}
}
}
fearNotLetter("abcdefghjklmno");
Okay, I figured it out!
Let me save my code:
function fearNotLetter(str) {
var strArray = str.split('');
var unicodeArray = [];
var previousLetterCharCode;
var currentLetterCharCode;
for (var i = 0; i < strArray.length; i++) {
unicodeArray.push(strArray[i].charCodeAt(0));
}
var comparisonArray = [];
for (var j = 0; j < unicodeArray.length; j++) {
//The current unicode value, +1, should equal the next unicode value if the order is correct. if a number is missing, then the current unicode value, +1, will not equal the next item in the array's unicode value. If this is the case, I want to get the value of the next unicode array number, and subtract one. That gives us the unicode value of the missing number.
if (unicodeArray[j] + 1 !== unicodeArray[(j+1)]) {
var unicodeForMissingLetter = unicodeArray[(j + 1)];
var convertedMissingLetter = String.fromCharCode((unicodeForMissingLetter - 1));
var regExFilter = /[a-z]/;
//If the output is a lower case letter from a to z (if statement will be true), return letter.
if (convertedMissingLetter.match(regExFilter)) {
return convertedMissingLetter;
}
//If the output is anything other than a lower case letter from a to z, return undefined.
else {
return undefined;
}
}
}
}
fearNotLetter("abcdefghijklmnopqrstuvwy");
All right, 11 challenges to go, moving on to the next one! Ok, this next one was too easy. Here's the question:
And the answer:
That was too easy, I think it should have been in the basic algorithms. This works also:
Cool. It was basic, but I learned more about typeof. 10 more intermediate challenges to go. The next challenge is called "Sorted Union," here's the problem:
All right, let me get to work on this.
Saving my code so far:
function unite(arr1, arr2, arr3) {
var argumentArray = arguments;
for (var i = 0; i < arr1.length; i++) {
if (arr1[i].length > 0) {
for (var j = 0; j < arr1[i].length; j++) {
arr1[i][j] = 5;
}
}
}
for (var k = 0; k < arr1.length; k++) {
if(typeof arr1[k] === 'number') {
arr1[k] = 5;
}
}
var x = arguments.length;
/*var combinedArray = [];
for (var i = 0; i < arguments.length; i++) {
combinedArray.push(arguments[i]);
}
var flatArray = combinedArray.reduce(function(a, b) {
return a.concat(b);
});
var check = arr1[0].length;*/
return x;
}
unite([1, 3, [1, 5, 4], 2], [5, 2, 1, 4], [2, 1]);
All right, still working on this...
function unite(arr1, arr2, arr3) {
var argumentArray = arguments;
for (var l = 0; l < arguments.length; l++) {
for (var k = 0; k < arguments[l].length; k++) {
if(typeof arguments[l][k] === 'number') {
arguments[l][k] = 5;
}
if (typeof arguments[l][k] === 'object') {
for (var m = 0; m < arguments[l][k].length; m++) {
arguments[l][k][m] = 5;
}
}
}
}
return arguments;
}
unite([1, 3, 2], [1, [5]], [2, [4]]);
The code so far filters through every item in the argument (the three arrays and the arrays within the arrays) and turns everything into a 5. I did that just to test if I was actually reaching into the arrays within the arrays. So now I need to find a way to apply the reduce function to every element within the argument to remove any duplicates.
O.k., that one was difficult, I learned one more use for .indexOf(). Here's my final code, I completed the problem.
All right, moving on, 9 Intermediate JavaScript Algorithms left! The next problem is called "Convert HTML Entities." Here's the problem:
All right, let me get to work on it. Okay, this one was very easy, here's my solution:
It's time for bed, it's late now. Today was great, 8 more intermediate algorithms left until I get to the projects. It looks like the FCC guys move the JSON section before the Intermediate JavaScript Algorithms. Tomorrow I'll decided whether to continue with algorithms or knock out the JSON section already, it's a short section, according to the time estimate (2 hours).
SUMMARY OF CODING SKILLS
Total Treehouse Points: 5,503
Treehouse Points by Subject Matter (Miscellaneous not included):
HTML: 663
CSS: 1,599
Design: 1,193
Development Tools: 747
JavaScript: 1,239
Treehouse Ranking (%): "You have more total points than 93% of all students."
Treehouse Courses Completed:
How to Make a Website
HTML
CSS Foundations
CSS Layout Techniques
Aesthetic Foundations
Design Foundations
Adobe Photoshop Foundations
Adobe Illustrator Foundations (66% complete, switched focus from web design to web dev)
Console Foundations
Git Basics
Introduction to Programming
JavaScript Basics
Codecademy (& other) Courses Completed:
HTML and CSS (Codecademy)
Design Foundations
Adobe Photoshop Foundations
Adobe Illustrator Foundations (66% complete, switched focus from web design to web dev)
Console Foundations
Git Basics
Introduction to Programming
JavaScript Basics
Codecademy (& other) Courses Completed:
HTML and CSS (Codecademy)
Books Read or in Progress:
Completed: "Head First HTML and CSS," by E. Robson & E. Freeman
Completed: "A Smarter Way to Learn JavaScript," by Mark Myers
Completed: "HTML and CSS," by Jon DuckettCompleted: "JavaScript and JQuery," by Jon Duckett
My Progress on The Odin Project:
1. Introduction to Web Development 100% Complete
2. Web Development 101 33% Complete
Note: I switched to FCC for the great online community and better updates/support.
Note: I switched to FCC for the great online community and better updates/support.
My Progress on Free Code Camp (FCC):
1. Get Started with Free Code Camp Complete
2. HTML5 and CSS Complete
3. Responsive Design with Bootstrap Complete
4. Gear up for Success Complete
5. jQuery Complete
6. Basic JavaScript Complete
7. Object Oriented and Functional Programming Complete
8. Basic Algorithm Scripting Complete
9. Basic Front End Development Projects Complete
10. Intermediate Algorithm Scripting On 12 of 21 (#13 and #14 also done)
11. JSON API's and Ajax
12. Intermediate Front End Development Projects
13. Claim Your Front End Development Certificate
14. Upper Intermediate Algorithm Scripting
15. Automated Testing and Debugging
16. Advanced Algorithm Scripting
17. AngularJS
18. Git
19. Node.js and Express.js
20. MongoDB
21. Full Stack JavaScript Projects
22. Claim Your Full Stack Development Certificate
After the 800 hours of FCC work above, there are 800 more hours of non-profit coding projects.
Hours Spent Coding Today: 6
Total Hours Coding: 853
No comments:
Post a Comment