Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save brycemara/d376fd41fc4981ec2cfede4b9b390bb5 to your computer and use it in GitHub Desktop.
Save brycemara/d376fd41fc4981ec2cfede4b9b390bb5 to your computer and use it in GitHub Desktop.
Mod 0 Session 1 Practice Tasks

Session 1 Practice Tasks

The assignments listed here should take you approximately 60 minutes.

To start this assignment, click the button in the upper right-hand corner that says Fork. This is now your copy of the document. Click the Edit button when you're ready to start adding your answers. To save your work, click the green button in the bottom right-hand corner. You can always come back and re-edit your gist.

1. Markdown (20 min)

Markdown is the format all of your homework gists are written in.

Using this markdown cheatsheet, create a new gist of your own by clicking the New Gist button in the upper right-hand corner of the screen. Create a "Beginners Guide to data types" documenting your data types knowledge so far using Markdown.

NOTE: Remember to add a .md file extension to filename of your new Gist. Otherwise it will not register as markdown.

Incorporate each of the following features into your Gist:

  • at least two headings of different sizes

  • at least one numbered list

  • at least one bullet point list

  • at least one bold word/phrase

  • at least one italic word/phrase

  • at least one code block

  • at least one inline code block (greyed text)

  • at least one image

  • Paste the link to your gist here:https://gist.github.com/brycemara/25c5560b2825930bef79fb776f7fe9d4

2. Documentation and Googling (20 min)

Documentation of a language, framework, or tool is the information that describes its functionality. For this part of the practice tasks, you're going to practice digging into documentation and other reference material.

NOTE: Remember to look for the docs! mdn for javascript and ruby-doc for ruby.

  • In your own words, what does the JavaScript/Ruby string split method do (pick based on your program)? As you're explaining, be sure to provide an example. Your answer: For Java Script the split string method will split your string into sub-strings which is an ordered list and puts them into an array. (MDN web docs) Example: For Ruby its the same process but is split into paragrpahs that are delimited by new lines. (ruby-doc) Example: "bryce\caden\piper".each_line {|s| p s} would give you "bryce" (new line) "caden" (new line) "piper"

  • What did you Google to help you with this task, and how did you pick your results? 'java script string split method define' I used the MDN web docs because yesterday David said that is the best website for FE. 'ruby string split method define' then i chose ruby-doc again because david said that was a good website but it was harder to understand the wording vs MDN web doc. I also had to command F 'split' because there was so much info for ruby.

  • In your own words, what does the JavaScript/Ruby array slice method do (pick based on your program)? As you're explaining, be sure to provide an example. Your answer: For Java Script the slice method with an array will put a portion of the old array into an array object (i think of this as like a new array that is only calling up certian variables in the original array ot be shown) Example: so if my array was const siblings = ['bryce', 'caden', 'piper'] and i just wanted the first two variables in my array i would use console.log(siblings.slice(3)); and it would return ['bryce', 'caden'] and leave out the last string.

For Ruby its the same process, when only calling up x number of variables within the array. Example: so if I wanted to again only have bryce and caden (refering to my original array above) in my array I would use siblings[0,2] and piper would be left out.

  • What did you Google to help you with this task, and how did you pick your results? 'java script slice array method define' is what I searched and again I used the MDN web doc to find my examples/definitions. 'ruby array slice method define' is what I searched but this time after looking at ruby-doc I was very lost so I looked at Paul Rayner's definition and that was what helped it make sense to me.

3. Data Types and variable assignment (20 min)

Imagine that you're taking your favorite board game and turning it into a computer-based game.

  • Name of board game: LIFE

  • Use the space below to categorize game data into each of the following data types. You should have a minimum of two variables assigned for each data type below. Feel free to break each variable declaration on to its own line. Pick either ruby or javascript based on your program (see examples below for how they should look)

  1. String data: var player_one = 'bryce' var player_one_piece = 'blue car'

  2. Integer and/or float data: num_passengers_player_one = 2 num_pets_player_one = 1

  3. Boolean data: player_one_rich = false player_one_female = true

  4. Array data: player_one_rolls = [6, 9, 4] player_two_rolls= [4, 6 7]

  5. OPTIONAL: Hash or Object data:

4. Questions/Comments/Confusions

If you have any questions, comments, or confusions from the any of the readings that you would like an instructor to address, list them below:

@mschae16
Copy link

@brycemara - Nice work here overall. I'm impressed you went above and beyond in exploring both MDN and the ruby docs for your explanations of split and slice (only 1 definition was required here based on which program you're in). Your markdown practice looks great - that's a skill that will come in really handy and I encourage you to keep practicing it.

Your practice on data types and variable assignment looks solid. With respect to naming of boolean variables, we generally try to think of names that reflect the question the value answers. For example, the var player_one_rich could become var is_player_one_rich = false. (It's almost like asking a question).

Keep up the hard work and feel free to reach out with any questions you might have.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment