const square = function(x) {
  return x * x;
};const power = function(base, exponent) {
  let result = 1;
  for (let count = 0; count < exponent; count++) {
    result *= base;
  }
  return result;
};let x = 10;
if (true) {
  let y = 20;
  var z = 30;
  console.log(x + y + z);
  // → 60
}
// y is not visible here
console.log(x + z);
// → 40const halve = function(n) {
  return n / 2;
};
let n = 10;
console.log(halve(100));
// → 50
console.log(n);
// → 10function square(x) {
  return x * x;
}
const square1 = (x) => { return x * x; };
const square2 = x => x * x;function greet(who) {
  console.log("Hello " + who);
}
greet("Harry");
console.log("Bye");
Call stack:
not in function
   in greet
        in console.log
   in greet
not in function
   in console.log
not in functionfunction power(base, exponent) {
  if (exponent == 0) {
    return 1;
  } else {
    return base * power(base, exponent - 1);
  }
}
power(2, 3)power(2, 3)
  power(2, 2)
    power(2, 1)
      power(2, 0) -> stop(if === 0)
power(2, 0) -> 1
power(2, 1) -> 2
power(2, 2) -> 4
power(2, 3) -> 8
let listOfNumbers = [2, 3, 5, 7, 11];let listOfNumbers = [2, 3, 5, 7, 11];
console.log(listOfNumbers[2]);
// → 5
console.log(listOfNumbers[0]);
// → 2
console.log(listOfNumbers[2 - 1]);
// → 3const apple = {
  color: 'red',
  shape: 'round'
}let doh = "Doh";
console.log(typeof doh.toUpperCase);
// → function
console.log(doh.toUpperCase());
// → DOHaddTask('task')
nextTask()
addUrgentTask('task')
['first task', 'second task', 'third task']['first task', 'second task', 'third task']['first task', 'second task', 'third task']let myObject = {
    todos: [],
    showTodoList() {
        console.log(this.todos);
    }
}Środa - 27.06.2018 do 18:00