Whiteboarding Problems
Whiteboarding problems from The Iron Yard-Austin Front End Engineering class
October-November 2015
greater-integer.js
Create a function that, given two integers, returns the greater of the two
hello-name.js
Create a function that takes a name and display "hello" plus that name
- Display "hello" plus that name if the name begins with "A-L"
- Display "goodbye" plus that name if the name begins with "M-Z"
dice-roll.js
Create a function "dice" that will return a roll of 2 dice between 1 & 6
month-number.js
Given a month number, return the name of the month
absolute-value.js
Create a function that determines the absolute value of a given number
smallest-integer.js
Create a function that, given three numbers, returns the smallest of the three
random-element.js
Given an array, return one randomly selected element
value-in-array.js
Given an array and a value:
- Return true if the value exists in the array
- Return false if it does not exist in the array
- Do not use
indexOf
or.find
largest-in-array.js
Given an array of integers, return the largest integer
sum-of-array.js
Given an array of numbers, return the sum of all numbers
number-positive.js
Given an array of numbers, return the number of positive numbers
ask-input.js
Create a function that will ask user a yes or no question.
- It will continue to ask until their input is "yes" or "y" or "no" or "n"
has-own-property.js
Recreate the method hasOwnProperty
- Takes an object and string as arguments
- Return true if the property exists in the object
- Return false if the property does not exist in the object
number-of-each-letter.js
Create a function that takes a string
- Return an object with each letter and number of times it occured in the string
insert-string.js
Given two strings, put the second string in the middle of the first string