Skip to content

Instantly share code, notes, and snippets.

@rmurphey
Created May 21, 2012 19:45
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save rmurphey/2764220 to your computer and use it in GitHub Desktop.
Save rmurphey/2764220 to your computer and use it in GitHub Desktop.
Self-Assessment for Bocoup's "Foundations of Programming with JavaScript" Training

Self-Assessment for Bocoup's "Foundations of Programming with JavaScript" training

This gist is aimed at helping you assess whether you'll be a good fit for Bocoup's "Foundations of Programming with JavaScript" training. This class is aimed at introducing you to fundamental concepts of development using JavaScript. In this class, you'll work through the process of building a simple game of hangman; along the way, you'll learn about functions, arrays, objects, and prototypes, and get a brief introduction to the jQuery library. You'll also learn about approaches that will help you write more maintainable code, and get introduced to tools for debugging and testing your JavaScript.

Is this class right for you? We don't assume any knowledge of JavaScript, but because this class will focus heavily on learning via in-class exercises, we do want to make sure that you're able to follow along and understand basic coding concepts.

To that end, you'll want to make sure that you're comfortable answering the following questions -- or at least making educated guesses -- in order to get the most out of the class.


What do you think the following code does?

function fn(msg, time) {
  setTimeout(function() {
    console.log(msg);
  }, time);
}

fn('it works', 1000);

What do you think the following code does?

function fn(num) {
  return (num > 3) ? 'TOO BIG' : num;
}

console.log([ 1, 2, 3, 4, 5 ].map(fn));

Given the following HTML, what are five different CSS selectors you could use to target the text input? Which would be your preference?

<form id="guess-entry" class="form-inline well">
  <input type="text" name="guess" placeholder="Enter your guess"/>
  <button class="btn btn-primary">Guess</button>
</form>

Consider the following markup and code; what do you think happens after the user submits the form?

<form id="guess-entry" class="form-inline well">
  <input type="text" name="guess" placeholder="Enter your guess">
  <button class="btn btn-primary">Guess</button>
</form>
$('#guess-entry').on('submit', function(e) {
  e.preventDefault();

  var form = $(this);
  form.find('button').prop('disabled', true).removeClass('btn-primary');
  form.find('input').prop('disabled', true);
});

What do you think the following code does?

function fn(num, range) {
  for (var i = 1; i <= range; i += 1) {
    var divisible = (num % i === 0) ? 'is' : 'is not';
    console.log('%d %s divisible by %d', num, divisible, i);
  }
}

fn(200, 10);
@Crazycorner
Copy link

The first seems to be an alarm the next was a formula that couldn't follow thru. Then there was me at the begining. The othere I have not a clue. Ask me again when I finished training.

@Crazycorner
Copy link

I'm looking forward to this. Thank you!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment