Git Product home page Git Product logo

constructors's Introduction

Week 11 Homework for Constructors Introduction

This week's homework is VERY similar to exercises we've done in class. Take it as a chill week :-) Steps

Make a student constructor function.

In a new folder

auto create a package.json file with npm init

use npm install prompt --save to install prompt

make a new node file called main.js

require prompt in it

make a new node file called student.js

Inside student.js, make a constructor function called Student that creates a student object with properties of name, gender, grade, GPA, detentions, sleepingInClass, catchPhrase, and a function called canStudentHaveFun that checks if they have less than 10 detentions and above a 2 GPA. If they do then console.log out to the terminal that the student can have fun.

Prompt the user for a student's information, make a new Student Object with it, then invoke the canStudentHaveFun function.

export the student constructor at the bottom of the file

make a new node file called bus.js

inside the bus.js file, make a bus constructor function, that has the following properties:

studentsOnTheBus (array)

driverName (string)

color (string)

gas (integer)

studentEntersBus (function that adds a student to the studentsOnTheBus property)

busChatter (function that outputs the students' catch phrases if they can have fun one by one) at the bottom of bus.js, export the constructor function

require the appropriate file(s) in the appropriate file(s).

in main.js make the bus object with the constructor function, and then add 20 students to it. Then successfully all the busChatter property of the bus object.

constructors's People

Contributors

angelica3010 avatar

Watchers

James Cloos avatar  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.