Last active
May 28, 2019 16:30
-
-
Save lukealbao/e88db10608debc492d23 to your computer and use it in GitHub Desktop.
Quick JS Question
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 inventory = { | |
'000001': { | |
name: 'Banana Slicer', | |
price: 2.99 | |
}, | |
'000002': { | |
name: 'Three Wolves Tea Cozy', | |
price: 14.95 | |
} | |
}; | |
function tenPercentOffOf (obj) { | |
obj.price = Math.round(0.9 * obj.price * 100) / 100; | |
return obj; | |
} | |
// INSTRUCTIONS | |
// | |
// Please refer to the following Javascript variable declaration. When submitting your | |
// application, please answer the following three questions at the top of your cover | |
// letter, before any salutations or headings. | |
// | |
// var bargainBananaSlicer = tenPercentOffOf(inventory['000001']); | |
// | |
// Question 1: After declaring that variable, what is the value of bargainBananaSlicer.price? | |
// Question 2: After declaring that variable, what is the price of the Banana Slicer | |
// in the inventory object? | |
// Question 3: Can you suggest ways to improve this code? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment