This repo serves as an example of what a partial JavaScript assessment may look like.
- Clone this repo
- Create a branch called
firstName_lastName
where you use YOUR first name and last name- Note: to do this, you can create a branch and move to it with the command
git checkout -b YOUR_BRANCH_NAME
- Note: to do this, you can create a branch and move to it with the command
- Open the
test-runner.html
file in a browser and notice the failing tests - Write the needed JavaScript in the
solutions.js
file to pass all the tests - Add and commit for each completed problem
- When instructed, push your work with the command
git push origin YOUR_BRANCH_NAME
- Define a function,
sayHello
, that returns the stringhello
.
sayHello() // 'hello'
- Define a function,
returnSecondToLastChar
that returns the second to last character of a given string input. A string ofimproper input
should be returned if the function is invoked with no input or if the input is not a string. The function should return an empty string if passed an empty string as input or a one character string.
returnSecondToLastChar('dog') // 'o'
returnSecondToLastChar('hello') // 'l'
returnSecondToLastChar('What a goose am I') // ' '
returnSecondToLastChar('8675309') // '0'
returnSecondToLastChar('') // ''
returnSecondToLastChar('W') // ''
returnSecondToLastChar(null) // 'improper input'
returnSecondToLastChar(123) // 'improper input'
returnSecondToLastChar(true) // 'improper input'
returnSecondToLastChar([]) // 'improper input'