Skip to content

Instantly share code, notes, and snippets.

@Ingelheim
Last active August 15, 2016 13:46
Show Gist options
  • Save Ingelheim/af410367667f684718b46877e794fa83 to your computer and use it in GitHub Desktop.
Save Ingelheim/af410367667f684718b46877e794fa83 to your computer and use it in GitHub Desktop.

Exercises

Javascript

  1. What value is now stored in the variable name?
var isKing = true;
var name = isKing ? ‘Arthur’ : ‘Hank’;
  1. What is the difference between == and === in Javascript?

  2. Write a function that takes two numbers as arguments and returns the sum of the two numbers in Javascript

  3. Write a function that takes an array as an argument and prints out the numbers in the array that are greater than 5 (for example foo([3,6,1,7]) would print out 6 and 7) in Javascript

  4. Write a for loop that will iterate from 0 to 20. For each iteration, it will check if the current number is even or odd, and report that to the screen in Javascript

  5. What does 'this' refer to when used in a Java method?

  6. Create an object that has properties with name = "fred" and major="music" and a property that is a function that takes 2 numbers and returns the smallest of the two, or the square of the two if they are equal.

  7. What’s the result of executing this code and why?

function test() {
   console.log(a);
   console.log(foo());
   
   var a = 1;
   function foo() {
      return 2;
   }
}

test();

Git

  1. Assume that you created a new file in a project. What would you do to start tracking it under git (let's assume that the direktory you are currently in already exists)?

  2. In the morning, what would you do to make sure you have the most current git branch on your local machine?

Command line

  1. How would you create a new folder named 'new_folder' in the command line?

  2. Assuming you created that folder, how would you access that folder using the command line?

HTML

  1. What is an 'ul' and an 'ol' in HTML? What are the similarities and differences?

  2. What is the HEAD and BODY in HTML? What would both contain?

  3. How would you require a javascript file (for instance test.js, which is on the same level as the HTML) in HTML?

  4. How qould you require a css file (for instance test.css, which is two level deeper as the HTML) in HTML?

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