Giter VIP home page Giter VIP logo

js-object-oriented-static-class-functions-lab-abp-11-17's Introduction

Static Class Functions and Properties Lab

Objectives

  1. Define a Class property
  2. Build a Class function
  3. Access a Class property from an instance function.
  4. Build a Class function that access a Class property.

Instructions

The goal of this lab is to build a Question class in question.js that can store all instances, save them, retrieve them, and find them.

Question Class

Define a Question class using the class syntax of Javascript.

_All Class Property

Add a property, _All to the Question class and initialize its value to an empty Array.

.All() Class function

Define a class function with the static keyword, All() that returns the value of the class property _All.

save() instance function

Define a save() instance function that can add the instance to the _All class property.

constructor(content)

The Question constructor should accept the content of the question and set that as an instance property of the question via a question instance property.

Additionally, the constructor should save the new instance by calling the save() instance function.

.Find(id) class function

Build a static class function that can return the question by Id. The function should allow you to reference the Id of the question, not its index within the _All array. If there are 3 questions in _All, Find(2) should return the second one, not the 3 one.

js-object-oriented-static-class-functions-lab-abp-11-17's People

Contributors

aviflombaum avatar thepeej avatar

Watchers

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