Skip to content

JSDR213/functions_lab-1

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 

Repository files navigation

Functions Exercise:

  1. Write a function called logIn that takes your name as a parameter and console.logs 'Hello /your name/!' when it is called

  2. Take that function up a notch by creating a new variable called isLoggedIn, that logs 'Hello /your name/!' when the variable is true, or "please log in" when it is false

  3. We are looking to re-sod our lawn. It has a length of 20' and a width of 30', with Sod costing $1.45/sqft. Additionally, it will cost $100 to have thew work done. Write a function that finds the area of the lawn, the price of the Sod, and what the total cost will be to get the lawn redone

  4. Write a function that loops over the following array of SEI students and prints out their name, and how many letters their name is

const students = [
  'Alice',
  'Andrew',
  'Casey',
  'Damian',
  'Grant',
  'Howie',
  'Wade',
  'Kat',
  'Kimbrad',
  'Kiu',
  'Natasha',
  'Obi',
  'Pedro',
  'Sarah',
  'Scott',
  'Tiffany',
  'Zhe'
]

It should give us "Alice is 5 letters long"... and so on

  1. FizzBuzz

  2. Write a javascript application that logs all numbers from 1 - 100.

  3. If a number is divisible by 3 log "Fizz" instead of the number.

  4. If a number is divisible by 5 log "Buzz" instead of the number.

  5. If a number is divisible by 3 and 5 log "FizzBuzz" instead of the number.

  6. Checkerboard

Set a checkerboard size to a variable

const boardSize = 8;

Now, using what you know about control flow, build a checkerboard

 # # # #
# # # # 
 # # # #
# # # # 
 # # # #
# # # # 
 # # # #
# # # # 

You should be able to change the variable boardSize and generate a larger or smaller grid

const boardSize = 20;

Should now generate:

 # # # # # # # # # #
# # # # # # # # # # 
 # # # # # # # # # #
# # # # # # # # # # 
 # # # # # # # # # #
# # # # # # # # # # 
 # # # # # # # # # #
# # # # # # # # # # 
 # # # # # # # # # #
# # # # # # # # # # 
 # # # # # # # # # #
# # # # # # # # # # 
 # # # # # # # # # #
# # # # # # # # # # 
 # # # # # # # # # #
# # # # # # # # # # 
 # # # # # # # # # #
# # # # # # # # # # 
 # # # # # # # # # #
# # # # # # # # # # 

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published