Skip to content

Instantly share code, notes, and snippets.

@airportyh
Created August 17, 2016 22:32
Show Gist options
  • Select an option

  • Save airportyh/59332d798d47161a389deafef16a3a08 to your computer and use it in GitHub Desktop.

Select an option

Save airportyh/59332d798d47161a389deafef16a3a08 to your computer and use it in GitHub Desktop.

Exercises

Make a Sentence

Given the following variable declarations:

var person = 'Lee';
var car = 'Honda Civic';

Form a sentence about Lee and his car. You will store the sentence in a new variable called sentence.

Once, you are done, you will print out the contents of the sentence variable using console.log, like so:

console.log(sentence);

Days of the Week

Given a number between 0 and 6, print a day of the week. 0 for Sunday, 1 for Monday, 2 for Tuesday, and so on. Once you are done writing the logic, change the value of dayOfWeek to see other results are printed correctly.

var dayOfWeek = 0;
// fill in the logic here

Work or Sleep In?

Given a number between 0 and 6 representing the days of the week, print "Go to work." if it's a work day and "Sleep in." if it's a weekend day. Once you are done writing the logic, change the value of dayOfWeek to see other results are printed correctly.

var dayOfWeek = 0;
// fill in the logic here

Uppercasing a String

Given a string, print the string uppercased using console.log.

var sentence = 'JavaScript is cool';
// fill in code here

Print the length of a string

Continue from the last exercise, print the length of a string using console.log.

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