Coder Social home page Coder Social logo

fewds-js-basics-arithmetic-lab-dc-fe-skills-111218's Introduction

Arithmetic Lab

Assignment

It's time for your first solo assignment since joining the Flatbook team!

Here at Flatbook HQ, we're a bit overwhelmed by all of the user data we've been collecting, and we need some help crunching the numbers.

There are three challenges we need you to solve. Code your solution in index.js. We'll provide some brief instructions here, but you should really rely on the test failure messages to guide your code.

Instructions

  1. When we started out, we assigned ID numbers sequentially to new users, so our first user ID is 1, second is 2, third is 3, and so on. That was fine when we were a fledgling company, but, now that we have millions of active users, it would be easier if all of our user IDs were the same length. We'd like the IDs to start from 1000000001 (one billion and one) instead of 1. Create a variable named newID that adds 1000000000 to the value in oldID. Don't define oldID — assume the system already knows what it is just by using that variable name.

  2. During the sign-up process, we require new users to provide their age. However,the junior developer tasked with creating the sign-up form forgot to validate that the user had entered an integer, so we have a lot of accounts floating around with weird ages like 21.7 or 9.5. We'd like you to help us identify which users need to be prompted to reenter their age. Create a variable named ageIsValid that checks whether the value in currentAge is a valid integer. You don't have to define currentAge — the system will take care of that part.

  3. Finally, we need a way to randomly select a user by their ID number. As you know, we have millions of active users, but since this is your first assignment we'll limit the testing pool to twenty users with IDs between 1000000001 and 1000000020. You're tasked with creating three variables:

  • randomNumber, which should contain a randomly-generated number between 0 (inclusive) and 20 (exclusive).
  • randomInteger, which should take the value in randomNumber and round it down to the nearest integer.
  • randomUserID, which should convert randomInteger into a valid ID number — an integer between 1000000001 and 1000000020.

Good luck

Resources

View Arithmetic Lab on Learn.co and start learning to code for free.

fewds-js-basics-arithmetic-lab-dc-fe-skills-111218's People

Contributors

gj avatar greysonh avatar jeffkatzy 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.