Learn modern JavaScript

Learn modern JavaScript

    console.log("Hello from JavaScript");
    let catName = "Quincy";
    let quote;
    
    catName = "Beau";
    
    function catTalk() {
      "use strict";
    
      catName = "Oliver";
      quote = catName + " says Meow!";
    
    }
    catTalk();
    function checkScope() {
    "use strict";
      //let i = "function scope";
      if (true) {
        let i = "block scope";
        console.log("Block scope i is: ", i);
      }
      console.log("Function scope i is: ", i);
      return i;
    }
    
    checkScope();
    function printManyTimes(str) {
      "use strict";
    
      const SENTENCE = str + " is cool!";
      
      for(let i = 0; i < str.length; i+=2) {
        console.log(SENTENCE);
      }
    
    }
    printManyTimes("freeCodeCamp");
    const s = [5, 7, 2];
    function editInPlace() {
      "use strict";
    
      //s = [2, 5, 7];
      s[0] = 2;
      s[1] = 5;
      s[2] = 7;
    
    }
    editInPlace();
    
    console.log(s)
    function freezeObj() {
      "use strict";
      const MATH_CONSTANTS = {
        PI: 3.14
      };
      
      Object.freeze(MATH_CONSTANTS);
    
      try {
        MATH_CONSTANTS.PI = 99;
      } catch( ex ) {
        console.log(ex);
      }
      return MATH_CONSTANTS.PI;
    const magic = () => new Date();
    const myConcat = (arr1, arr2) => arr1.concat(arr2);
    
    console.log(myConcat([1, 2], [3, 4, 5]));
    const realNumberArray = [4, 5.6, -9.8, 3.14, 42, 6, 8.34, -2];
    
    const squareList = (arr) => {
      const squaredIntegers = arr.filter(num => Number.isInteger(num) && num > 0).map(x =>;
      return squaredIntegers;
    };
    
    
    const squaredIntegers = squareList(realNumberArray);
    console.log(squaredIntegers);
    const increment = (function() {
      return function increment(number, value = 1) {
        return number + value;
      };
    })();
    console.log(increment(5, 2)); 
    console.log(increment(5)); 
    const sum = (function() {
      return function sum(...args) {
        return args.reduce((a, b) => a + b, 0);
      };
    })();
    console.log(sum(1, 2, 3));
    const arr1 = ['JAN', 'FEB', 'MAR', 'APR', 'MAY'];
    let arr2;
    (function() {
      arr2 = [...arr1]; // change this line
      arr1[0] = 'potato'
    })();
    console.log(arr2);
    var voxel = {x: 3.6, y: 7.4, z: 6.54 };
    
    var x = voxel.x; // x = 3.6
    var y = voxel.y; // y = 7.4
    var z = voxel.z; // z = 6.54
    
    const { x : a, y : b, z : c } = voxel; // a = 3.6, b = 7.4, c = 6.54
    
    
    const AVG_TEMPERATURES = {
      today: 77.5,
      tomorrow: 79
    };
    
    const LOCAL_FORECAST = {
      today: { min: 72, max: 83 },
      tomorrow: { min: 73.3, max: 84.6 }
    };
    
    function getMaxOfTmrw(forecast) {
      "use strict";
    
      const { tomorrow : { max : maxOfTomorrow }} = forecast; 
    
      return maxOfTomorrow;
    }
    
    console.log(getMaxOfTmrw(LOCAL_FORECAST)); 
    const [z, x, , y] = [1, 2, 3, 4, 5, 6];
    console.log(z, x, y);
    
    
    let a = 8, b = 6;
    (() => {
      "use strict";
    
    })();
    // console.log(a); 
    // console.log(b); 
    const source = [1,2,3,4,5,6,7,8,9,10];
    function removeFirstTwo(list) {
    
      const [, ...arr] = list; 
    
      return arr;
    }
    const arr = removeFirstTwo(source);
    console.log(arr); 
    console.log(source);
    const stats = {
      max: 56.78,
      standard_deviation: 4.34,
      median: 34.54,
      mode: 23.87,
      min: -0.75,
      average: 35.85
    };
    const half = (function() {
    
      return function half({ max, min }) {
        return (max + min) / 2.0;
      };
    
    const person = {
      name: "Zodiac Hasbro",
      age: 56
    };
    
    // Template literal with multi-line and string interpolation
    const greeting = `Hello, my name is ${person.name}!
    I am ${person.age} years old.`;
    
    console.log(greeting); 
    
    
    
    
    const createPerson = (name, age, gender) => ( { name, age, gender });
    console.log(createPerson("Zodiac Hasbro", 56, "male")); 
    const bicycle = {
      gear: 2,
      setGear: function(newGear) {
        "use strict";
        this.gear = newGear;
      }
    };
    
    bicycle.setGear(3);
    console.log(bicycle.gear);
    class SpaceShuttle {
      constructor(targetPlanet){
        this.targetPlanet = targetPlanet;
      }
    }
    var zeus = new SpaceShuttle('Jupiter');
    
    console.log(zeus.targetPlanet)
    
    
    
    function makeClass() {
      class Vegetable {
        constructor(name){
    class Book {
      constructor(author) {
        this._author = author;
      }
      // getter
      get writer(){
        return this._author;
      }
      // setter
      set writer(updatedAuthor){
        this._author = updatedAuthor;
      }
    }
    
    import { capitalizeString } from "./string_function"
    const cap = capitalizeString("hello!");
    
    console.log(cap);
    const capitalizeString = (string) => {
      return string.charAt(0).toUpperCase() + string.slice(1);
    }
    
    const foo = "bar";
    const bar = "foo";
    function subtract(x,y) {return x - y;}
    import subtract 
    
    subtract(7,4);
    console.log("Congratulations!!!");
    
    // Regular Expressions Course: https://scrimba.com/g/gregularexpressions

A methodical walk-through of modern JavaScript features 👩‍💻

This course features freeCodeCamp's ES6 curriculum recorded as Scrimba screencasts. It contains 26 lectures, each of which explains a concept of ES6. Throughout the lectures you'll build the skills you need in order to utilize JavaScript's modern features. And thanks to the interactivity of Scrimba, you'll be able to get your hands dirty with the code as well, as you can jump into the code and interact with it whenever you want.

About freeCodeCamp

The lectures are recorded by Beau Carnes. Beau is the man behind some of the most popular courses at freeCodeCamp's YouTube channel, so you'll be in good hands. He explains concepts clearly and thoroughly, but without wasting your time.

Good luck, and happy coding!