Toy problems are brief exercises that emphasize formulating a quick solution to a task. They are questions that an employer might ask for an interview such as writing a sorting algorithm, string manipulation and/or concatenation, and implementing mathematical functions. Here are some tips for becoming more efficent in toy problems.

1) Formulate an idea and RAPIDLY test it as quickly as possible. Make a shell for the function you are creating, and stick a console.log statement inside. Call this function and makes sure it outputs the statement.

var exponentiate = function(base, exponent) {
  console.log('inside function');  
};

exponentiate(2,4); // should print out 'inside function'

2) Assuming you have inputs, change your console.log statement to be something that log your inputs:

var exponentiate = function(base, exponent) {
  console.log('base:', base, 'exponent:', exponent);  
};

exponentiate(2,4); // should print out 'base: 2 exponent: 4'

3) Include a variable for the result, usually a number, string, or integer, and formulate a first attempt at the calculation you want to make. Make sure to return this result variable as well as log it to the console.

var exponentiate = function(base, exponent) {
  var result = 0;
  result = base * exponent;
  console.log('result', result);
  return result;
};

exponentiate(2,4); // should print out 'base: 2 exponent: 4'

4) After seeing that this is not the correct out, refactor and try another solution:

Part 2 will include common toy problems that more are based on. Stay tuned!