---
# System prepended metadata

title: General Function Challenges

---

# General Function Challenges

## Reverse String Function

Write a function reverse that takes a string and returns the reverse of the string

<iframe style="margin-bottom: 8px;" height="600px" width="100%" src="https://repl.it/@thinkful/reverse-function?lite=true" scrolling="no" frameborder="no" allowtransparency="true" allowfullscreen="true" sandbox="allow-forms allow-pointer-lock allow-popups allow-same-origin allow-scripts allow-modals"></iframe>

## Half or Double Function

Write a function halfOrDouble that takes a number and returns half the number if it is even and double if it is odd

<iframe style="margin-bottom: 8px;" height="600px" width="100%" src="https://repl.it/@thinkful/Half-or-double-Function?lite=true" scrolling="no" frameborder="no" allowtransparency="true" allowfullscreen="true" sandbox="allow-forms allow-pointer-lock allow-popups allow-same-origin allow-scripts allow-modals"></iframe>

## Remove Character Function

Write a function removeChar that takes a string and a char and returns the string with all instances of the char removed

<iframe style="margin-bottom: 8px;" height="600px" width="100%" src="https://repl.it/@thinkful/Remove-char-function?lite=true" scrolling="no" frameborder="no" allowtransparency="true" allowfullscreen="true" sandbox="allow-forms allow-pointer-lock allow-popups allow-same-origin allow-scripts allow-modals"></iframe>

## String Array to Number Array Function

Write a function strToNum that takes an array of number strings and returns an array of numbers

<iframe style="margin-bottom: 8px;" height="600px" width="100%" src="https://repl.it/@thinkful/String-Array-to-Number-Array?lite=true" scrolling="no" frameborder="no" allowtransparency="true" allowfullscreen="true" sandbox="allow-forms allow-pointer-lock allow-popups allow-same-origin allow-scripts allow-modals"></iframe>


## Budget function

The budget function should take an list of objects and a number and return the name of the objects that fit the budget. Make sure your objects have 'name' and 'price' keys like the one below. 
``` javascript=
let candyStore = [
 { name:"chocolate rasins", price:".5" },
 { name:"peanut butter cups", price:"3" },
 { name:"gum", price:"1" },
 { name:"jelly beans", price:".75" },
 { name:"lollipop", price:"1" },
 { name:"big lollipop", price:"5" },
 { name:"cotton candy", price:"2.5" }
]
```

<iframe style="margin-bottom: 8px;" height="600px" width="100%" src="https://repl.it/@thinkful/budget-function?lite=true" scrolling="no" frameborder="no" allowtransparency="true" allowfullscreen="true" sandbox="allow-forms allow-pointer-lock allow-popups allow-same-origin allow-scripts allow-modals"></iframe>

## countLetter function

The countLetter function should take a string and a letter and return the number of times the letter appears in the string

<iframe style="margin-bottom: 8px;" height="600px" width="100%" src="https://repl.it/@thinkful/countLetter-function?lite=true" scrolling="no" frameborder="no" allowtransparency="true" allowfullscreen="true" sandbox="allow-forms allow-pointer-lock allow-popups allow-same-origin allow-scripts allow-modals"></iframe>

## Average function

The average function should take a list of numbers and return the average of all the numbers

<iframe style="margin-bottom: 8px;" height="600px" width="100%" src="https://repl.it/@thinkful/Average-function?lite=true" scrolling="no" frameborder="no" allowtransparency="true" allowfullscreen="true" sandbox="allow-forms allow-pointer-lock allow-popups allow-same-origin allow-scripts allow-modals"></iframe>