Giter Club home page Giter Club logo

expert-es6's People

Contributors

adam8810 avatar ascott1 avatar flamingbear avatar hendrikswan avatar jamygolden avatar janusp avatar shidhincr avatar soundyogi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

expert-es6's Issues

Example suggestion

On the Expert ES6 course part 10, the example can template string when saying "hi name".

Destructuring objects should include simplified syntax example

When destructuring objects, if the intended name of your variable is the same name as the object property name, you can use a simplified syntax...

let {firstName, lastName, message} = args;

This is not only possible, some folks think that this is the good style and recommend not using the more flexible syntax because it doesn't read well and requires the reader to think about syntax instead of just reading the intent of the code.

I think the course should mention this.

Arrow Scope | `this` variable in setTimeout has access to `name`

In the following example:

function sayHello(){
    this.name = 'hendrik';

    setTimeout(function(){
        console.log('hello ' + this.name);
    }, 1500);
}

sayHello();

Nested function passed in setTimeout has access to name property. Since sayHello() has window as its execution context, it implicitly assigns name property to window, which is again the execution context of the nested function.

The example might be modified like this:

var person = {
    sayHello: function(){
        this.name = 'hendrik';

        setTimeout(function(){
            console.log('hello ' + this.name);
        }, 1500);
    }
}

person.sayHello();

Above code will not error out as there is no operation being performed on this.name

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.