Giter VIP home page Giter VIP logo

jstask2's Introduction

jsTask2

First create an array of objects called data with the following values:

  1. Principal- 2500, time- 1.8

  2. Principal- 1000, time- 5

  3. Principal- 3000, time- 1

  4. Principal- 2000, time- 3

NB: Each individual object should have 'principal' and 'time' as keys.

Write a function called "interestCalculator" that takes an array as a single argument and does the following:

Determine the rate applicable using the conditions:

  • If the principal is greater than or equal to 2500 and the time is greater than 1 and less than 3, then rate = 3

  • If the principal is greater than or equal to 2500 and the time is greater than or equal to 3, then rate = 4

  • If the principal is less than 2500 or the time is less than or equal to 1, then rate = 2

  • Otherwise, rate = 1;

Calculate the interest for each individual object using the formula: (principal * rate * time) / 100.

The function should return an array of objects called 'interestData' and each individual object should have 'principal', 'rate', 'time' and 'interest' as keys with their corresponding values.

Log the 'interestData' array to console BEFORE your return statement.

Finally, call/execute the function and pass the 'data' array you created.

jstask2's People

Contributors

create1666 avatar

Watchers

 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.