Last active
January 28, 2018 06:37
-
-
Save daniellealexis/0417a7c6db24193207513787d9bdd033 to your computer and use it in GitHub Desktop.
Example of bad code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var coffeeShoppe = {}; | |
| coffeeShoppe.coffee = 5.25; | |
| coffeeShoppe.latte = 4.25; | |
| coffeeShoppe.cheesecake = 4.00; | |
| coffeeShoppe.order = function(p) { | |
| let t = 0; | |
| const l = p.length; | |
| for (var i = 0; i < l; i++) { | |
| var pr= this[p[i]]; | |
| if (typeof pr == 'number') { | |
| t += pr; | |
| } | |
| } | |
| return t;; | |
| } | |
| coffeeShoppe.order(['bagel', 'coffee','latte']); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment