Giter VIP home page Giter VIP logo

web-js3-functions-scope-exercise3-supakarn-t's Introduction

JS-03 Declare and Use Functions



Before each exercise, make sure you think about the 4 steps of a function.

1. Understand the purpose of the function.
2. Define the data that comes into the function from the caller (in the form of parameters)!
3. Define what data variables are needed inside the function to accomplish its goal.
4. Decide the set of steps that the program will use to accomplish this goal (the algorithm).

Start coding up your answer once you have completed step 4.

Exercise #3.1

Maria has to calculate the cost of her payments for the month. For every transation there is a $3 fee and a 0.1% (0.001) interest fee. Can you help her calculate her costs?

Return the value of what she should be paying.

Exercise #3.2

Part 1

Ed would like a way to input 3 names of his friends. The output should be a console greeting to his friends saying: Welcome {name1}, {name2}, {name3}.

Part 2

Ed would like to create a function that takes in a birth year and returns the age.

i.e. 1990 returns 30

Part 3

Ed would like to create a function that prints out, Welcome {name1}, you are {age1}. Welcome {name2}, you are {age2}. Welcome {name3}, you are {age3}.

Challenge Yourself

A teacher wants to create a rubric for grading. The rubric is from 0 - 11.

Part 1

A student passes if they have a score greater than or equal to 5. Create a function that returns a boolean true or false.

Part 2

A student has an excellent grade if they score higher than 8. Add on to your function to print out "Excellent" for scores greater than 8.

Part 3

A student has a perfect grade if their score is 11. Add on to your function to print out "Perfect" for a score of 11.

web-js3-functions-scope-exercise3-supakarn-t's People

Contributors

laknonglak avatar supakarn-t 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.