GithubHelp home page GithubHelp logo

dts-kominfo-rea4a / challenge-promises-adityapras Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 62 KB

challenge-promises-Adityapras created by GitHub Classroom

License: MIT License

JavaScript 100.00%

challenge-promises-adityapras's Introduction

Tantangan: Promise

Seorang developer diminta untuk membuat suatu program yang menghitung jumlah film yang menyebabkan penontonnya 'marah' atau 'tidak marah' di sebuah bioskop.

Disediakan 2 buah file yang TIDAK PERLU DIMODIFIKASI: external.js dan index.js.

HANYA LAKUKAN MODIFIKASI PADA FILE promise.js

external.js berisi dua buah promise promiseTheaterIXX dan promiseTheaterVGC. Saat resolve/fulfilled, promise tersebut akan mengembalikan sebuah array of object dengan format sebagai berikut:

[
    {
        namaFilm: "Film A",
        hasil: "marah"
    },
    {
        namaFilm: "Film B",
        hasil: "tidak marah"
    },
    ...
]

index.js adalah file utama tempat memanggil promise yang perlu kalian buat, untuk mengembalikan jumlah film yang membuat 'marah' dan 'tidak marah'.

Buatlah sebuah promise pada file promise.js dengan nama promiseOutput. promiseOutput akan menerima parameter emosi yang berisi 'marah' atau 'tidak marah'.

Fungsi promiseOutput ini akan membaca data dari promiseTheaterIXX dan promiseTheaterVGC secara berurutan, kemudian menghitung jumlah 'marah' atau 'tidak marah' dari film yang ditonton oleh seseorang.

Contoh:

  • promiseOutput('marah') akan menghasilkan output 4
  • promiseOutput('tidak marah') akan menghasilkan output 2

challenge-promises-adityapras's People

Contributors

github-classroom[bot] avatar

Watchers

Aditya Prasetyo avatar

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.