Yeoman and JavaScript, etc

2 min read





(Currently laying in bed, terrible sinus headache today, writing this on my iPad in Editorial. If it\’s ridden with typos I\’ll fix them once I get up and head to my Mac).

So, my Code Newbie pal and former guest on the podcast Mark Pearyer (pronounced Pierre) and I, as well as a few other Code Newbies are working on a hangman app. Mark presented this nice looking boilerplate for the app. He said that he made the boilerplate with Yeoman generator. If you don\’t know what a boilerplate is check out this article.

I sat down and watched the Yeoman intro Yeoman intro video and immediately became excited about the possibilities for my own apps and websites.

Downloaded yo, bower, set up a test app, and run the grunt server. I\’m hooked. I plan on using Yeoman to build two apps I have an idea for.

Fun with For Loops and Arrays

I love loops. I can see how effective they would be when repeating tasks and functions. The most logical part of JavaScript for me is looping. Not sure why. In Free Code Camp\’s Codecademy track they\’ve grouped arrays and for loops together. It\’s strange when I think about JSON and JavaScript arrays and how they differ, where in JSON you can\’t mix data types (for example, integers and strings aren\’t allowed in the same array in JSON but can be in the same array in JavaScript). Anyway we built simple for loops with arrays like this:

var names = ["Tiffany", "John", "Joe", "Rick", "Jerri"];
for (var i = 0; i < names.length; i++) {
console.log("I know someone called " + names[i]);

The variable i refers back to the names in this case. Since we have an array and counting in the array begins at 0, the second part of the for loop is going to calculate the number of names in the names variable, or the length of the array. Then in the last part of the for loop, the loop is coming back around and counting up to the next name. It will do this because the ++ means to increase by 1. It will do this for the length of the array, and for as long as i is less than the length of the array. The console.log prints out the string and concatenates the string plus the names in the array.


So I\’m sharing, again, what I\’m listening to on Spotify. On the Code Newbie Discourse we talked about music to code by and I found some awesome wub wub dubstep to kill code by. I\’ll share my favorite here (NSFW):

CC BY-SA 4.0 Yeoman and JavaScript, etc by Tiffany White is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.