{"id":18572726,"url":"https://github.com/truecodersio/javascript_oop","last_synced_at":"2026-01-24T10:33:31.228Z","repository":{"id":41421654,"uuid":"327778139","full_name":"truecodersio/JavaScript_OOP","owner":"truecodersio","description":null,"archived":false,"fork":false,"pushed_at":"2022-08-23T18:03:52.000Z","size":4,"stargazers_count":1,"open_issues_count":1,"forks_count":181,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-17T14:31:53.521Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/truecodersio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-01-08T02:29:47.000Z","updated_at":"2024-08-29T02:52:55.000Z","dependencies_parsed_at":"2022-09-13T04:41:26.228Z","dependency_job_id":null,"html_url":"https://github.com/truecodersio/JavaScript_OOP","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":"benrbryant/Exercise_Template","purl":"pkg:github/truecodersio/JavaScript_OOP","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/truecodersio%2FJavaScript_OOP","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/truecodersio%2FJavaScript_OOP/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/truecodersio%2FJavaScript_OOP/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/truecodersio%2FJavaScript_OOP/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/truecodersio","download_url":"https://codeload.github.com/truecodersio/JavaScript_OOP/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/truecodersio%2FJavaScript_OOP/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28725362,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-24T10:24:43.181Z","status":"ssl_error","status_checked_at":"2026-01-24T10:24:36.112Z","response_time":89,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-06T23:07:03.581Z","updated_at":"2026-01-24T10:33:31.210Z","avatar_url":"https://github.com/truecodersio.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# JavaScript Object-Oriented Programming\n\n## Objective\n\nYour objective is to practice OOP concepts and JS class notation syntax.\n\n## Steps\n\n### Getting Started\n\n1. Open your command line and navigate to your `repos` directory (if you do not have a `repos` folder, then you can use `mkdir repos` to create one)\n2. Use this template repository to start a new project in your repos folder: `git clone \u003crepo_name\u003e`\n3. cd `repo_name` to navigate into your new repo directory\n4. Start Visual Studio Code and select 'Open Folder'. Then select `repo_name` to open the folder in the editor (or just type `code .` in your terminal inside the repo directory)\n5. Follow the instructions on the README.md file to complete exercises\n6. Open the app.js file to get started\n\n### Exercise 1\n\n- Expanding from our exercise example during the lesson, create a parent class `class Person {}` with properties for `name`, `pets`, `residence`, and `hobbies`. The Person class will also have a method `info()` and `soundOff()`.\n\n1. Use class notation to create a class named `Person`\n2. Declare the `constructor()` method with parameters `name` (string), `pets` (number), `residence` (string), and `hobbies` (array) allowed to be passed in\n3. The `constructor()` method assigns `this.` properties to each parameter\n4. Declare an `addHobby()` method on the class that takes in a new `hobby` (string), and adds it to the object's `hobbies` array property\n5. Declare a `removeHobby()` method on the class that takes in a `hobby` (string), and removes the hobby from the object's `hobbies` array property\n6. Declare a `greeting()` method that `console.log`'s a generic greeting for a Person... ex: `greeting() {console.log(\"Hello fellow person!\")}`\n\n### Exercise 2\n\nNow we'll create a subclass `Coder` that inherits from our `Person` class\n\n1. Use class notation to create a class named `Coder` that inherits from the `Person` class\n2. Declare the `constructor()` method with parameters `name` (string), `pets` (number), `residence` (string), and `hobbies` (array) allowed to be passed in\n3. Call the `super()` method inside the `constructor` method and pass in the given parameters\n4. Still inside the `constructor` body, assign `this.occupation` as `\"Full Stack Web Developer\"`\n5. Override the `greeting()` method to `console.log` a custom greeting from a coder...\n\n### Exercise 3\n\nLet's create instances of our classes\n\n1. Create a variable and assign a Person object to it using the `new` keyword followed by the class `constructor`\n2. Create a variable and assign a Coder object to it using the `new` keyword followed by the class `constructor`\n3. Call the object methods and `console.log` the object properties to test your work\n\n### Exercise 4\n\nIn this final exercise, we'll create a class that has the functionality of a basic calculator.\n\n1. Create a class called `Calculator`\n2. Initialize a `result` property within the calculator `constructor` with an initial value of `0`\n3. Declare methods on the class that represent basic arithmetic: `add()`, `subtract()`, `multiply()`, `divide()`\n  - These methods should currently take in 2 parameters, and assign the result of the appropriate arithmetic based on the method name to the object's `result` property\n  - Should return the result\n  - EXTRA: if only one value is passed in, use the object's current `result` value as the first value in the operation\n4. Declare a method called `displayResult()` that will `console.log` the result property stored on the object\n5. Test your work by instantiating an object from your class (using the class constructor), and calling some of the calculator methods\n\n---\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftruecodersio%2Fjavascript_oop","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftruecodersio%2Fjavascript_oop","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftruecodersio%2Fjavascript_oop/lists"}