Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in article: Load a JavaScript file dynamically #232

Open
truongtom1993 opened this issue Feb 8, 2022 · 0 comments
Open

Error in article: Load a JavaScript file dynamically #232

truongtom1993 opened this issue Feb 8, 2022 · 0 comments

Comments

@truongtom1993
Copy link

truongtom1993 commented Feb 8, 2022

const waterfall = function (promises) {
    return promises.reduce(
        function (p, c) {
            // Waiting for `p` completed
            return p.then(function () {
                // and then `c`
                **return c().then(function (result) {**
                    return true;
                });
            });
        },
        // The initial value passed to the reduce method
        Promise.resolve([])
    );
};

line 61 trong bài posts/load-a-javascript-file-dynamically.md có vẻ đang sai anh ơi, c là 1 Promise nên mình .then luôn ạ, mình đang gọi c như 1 hàm nên code báo lỗi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant