Code Monkey home page Code Monkey logo

js-fundamentals-functions-1's Introduction

Programming Fundamentals: Functions 1

Learning Objectives

  • Call functions to run the code in them and get the return value as a result
  • Create functions that take a single parameter
  • Create functions that take multiple parameters

Introduction

In this exercise you will first call some predefined functions and then create your own functions that must return a value based on the function requirements and the parameters supplied to the function

Setup

  • Fork this repository and clone your forked version to your machine

  • Install dependencies by running the command below while in the project's root directory:

    npm ci

Instructions

  • Read through the numbered comments - eg 1. Define a function... - in the following files to understand the requirements of this exercise.

    • src/calling-functions.js
    • src/creating-functions.js
    • src/creating-functions-multiple-args.js
  • Write your code directly below the numbered comment.

  • Add console.log()s to get visibility on your solution and run the file with the command node src/calling-functions.js etc

  • See src/example.js for some example functions

Running tests

  • To verify your solutions, run the test suite by running the npx jasmine command followed by the path to the corresponding test file for each src/.js file above, eg:

    npx jasmine spec/calling-functions.spec.js

  • Alternatively, run:

    npm test

  • To begin with, almost all of the tests will fail - only the example tests will pass with a green . You'll see many red Fs in your console, like the image below:

  • Your solution is complete when the all the red Fs have been replaced with green .s in your console, as shown below:

js-fundamentals-functions-1's People

Contributors

shahzadnaeem avatar joelzor avatar vherus avatar dearshrewdwit 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.