Click to reopen instructions.

This assessment consists of functions you need to write exercising your ability to use Javascript’s basic control constructs. It is a closed book assessment. You should stay on this tab until you are done and there should be no talking. This assessment is about how much you understand. There are no automatic tests but you can use the REPL to test things yourself.

You can move through the questions with the arrows at the upper right next to the 1 of indicator so if you're not sure how to write one function move on to another one and come back if you have time at the end. I want to see how much you do know. Note: you can also click on thingsLikeThis in these instructions and the questions to copy them to the clipboard to avoid spelling mistakes. (I.e. click to copy and then ⌘-v to paste wherever you want.)

Note The starter code contains a lot of functions. You do not need to worry about how those functions work and don’t need to change them. Write your code below them.

When you are done, please click on your Github username above and submit a GitHub pull request of the branch and request me as a reviewer. Doing this correctly is part of the assessment. If you are unsure how to request a review, please ask for help!

Put definitions here.

Revisions:

Questions of

Write a function named yesIfEven that takes a single argument which will be a number and returns the string 'yes' if the argument is even and 'no' otherwise.

Write a function named countXs that takes a single string argument and returns the number of 'x' characters that occur in the string.

Write a function named timesTable that takes a single number as its argument and emits a times table of all the products from 1 × 1 to n × n. Use the emit function defined in the starter code to actually emit the different values. It takes three arguments, the two numbers being multiplied and their product, and prints them out nicely; you just need to call it once for each pair of arguments. N.B. that order matters so, assuming you are emitting a times table that includes 2 × 3 you need to call both emit(2, 3, 6) and emit(3, 2, 6).

Write a function named containsX that takes a single string argument and returns a boolean that indicates whether the string contains any 'x' characters.

Write a function named sumSquares that takes a single number argument and returns the sum of the squares of all the positive integers less than the argument. For instance given the argument 4 it should return 14, i.e. 12 + 22 + 32, i.e. 1 + 4 + 9.

REPL