# 01. Convert a Number to a String!

## Examples:

`numberToString(123); // returns '123';`   numberToString(999); // returns '999';``

## Sample test:

`Test.expect(numberToString(67) === ‘67’);`

## Solutions:

`// Basicfunction numberToString(num) { return '' + num;}// ES6+ versionconst numberToString = num => `\${num}`;`

# 02. Keep up the hoop

## Test Cases:

`Test.assertEquals(hoopCount(3),”Keep at it until you get it” ) Test.assertEquals(hoopCount(11),”Great, now move on to tricks” )`

## Solutions:

`// Basicfunction hoopCount (n) { return n < 10 ?    “Keep at it until you get it” :    “Great, now move on to tricks”;}// ES6+ versionconst strOne = `Keep at it until you get it`;const strTwo = `Great, now move on to tricks`;const hoopCount = n => n < 10 ? strOne : strTwo;`

# 03. String repeat

## Example:

`repeatStr(6, "I") // "IIIIII" repeatStr(5, "Hello") // "HelloHelloHelloHelloHello"`

## Solutions:

`// Basicfunction repeatStr (n, s) {  let newStr = '';  for(let i = 0; i < n; i++) {    newStr += s;  }    return newStr;}// Using Built in methodfunction repeatStr (n, s) {  return s.repeat(n);}// ES6+ versionconst repeatStr = (n, s) => s.repeat(n);`

# 04. Calculate average

## Test Cases:

`Test.assertEquals(find_average([1,1,1]), 1);Test.assertEquals(find_average([1,2,3]), 2);`

## Solutions:

`// Basicfunction find_average(array) {  var sum = 0;  const length = array.length;  for (let i = 0; i < length; i++){    sum += array[i];  }  return sum/length;}// ES6+ versionconst find_average = (array) => {  return array.reduce((a, b) => a + b) / array.length;}`

# 05. Pillars

## Solutions:

`// Basicfunction pillars(num_pill, dist, width) {  if(num_pill > 1) {    return (dist * 100 * (num_pill - 1)) + ((num_pill - 2) * width);  } else return 0;}//ES6+const pillars = (num_pill, dist, width) => {  return num_pill > 1 ?    (num_pill - 1) * dist * 100 + (num_pill - 2) * width : 0;}`

# 06. Basic Mathematical Operations

## Instructions:

`basicOp('+', 4, 7)         // Output: 11basicOp('-', 15, 18)       // Output: -3basicOp('*', 5, 5)         // Output: 25basicOp('/', 49, 7)        // Output: 7`

## Solutions:

`function basicOp(operation, value1, value2) {  switch (operation) {    case '+': return value1 + value2;    case '-': return value1 - value2;    case '*': return value1 * value2;    case '/': return value1 / value2;    default: return 'Operation must be one of + - * /';  }}`

Written by