Skip to content

Latest commit

 

History

History
25 lines (19 loc) · 1.34 KB

exercises.md

File metadata and controls

25 lines (19 loc) · 1.34 KB

##Exercise: concatenate a lasagna on monday Using concatenation and the following variables, create the string "Heathcliff, Garfield, and Hobbes rule, Odie drools."

var cat1 = "Heathcliff"
var cat2 = "Garfield"
var cat3 = "Hobbes"
var dog = "Odie"

##Exercise: I don't know Create a file called what_if.js. In this file, create a variable first and assign it the value of "who". Also, create a variable called second and assign it to "what". Write some code that logs "THIRD BASE" to the console if the length of first is less than the length of second.

##Exercise: Fill in the blanks With a partner, finish the following code snippets by replacing the comments with code so the code does not break when run. This should be written in a js file and executed by Node in your terminal. You will need to change the values of first and last to make sure your code runs correctly.

var first = //YOUR FIRST NAME HERE
var last = //YOUR LAST NAME HERE

if //your first name is longer than your last name, log your first name, otherwise log your last name
if //the length of your first name is evenly divisible by your last name, log "what are the odds", otherwise log "Never tell me the odds!"
if //your first name's length is divisible by 2 AND your last name is divisible by 2, log "Even Steven!", otherwise log "How odd!"