Created
January 11, 2026 17:26
-
-
Save davidystephenson/c923bcbcdaa34961b011b393f1df49b7 to your computer and use it in GitHub Desktop.
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
| const theHobbit = { | |
| author: 'Tolkien', | |
| protagonist: 'Bilbo', | |
| pages: 300 | |
| } | |
| const theMatrix = { | |
| budget: 63000000, | |
| director: 'Wachowskis', | |
| title: 'The Matrix' | |
| } | |
| const watchmen = { | |
| author: 'Moore', | |
| protagonist: 'Rorschach', | |
| pages: 450, | |
| } | |
| const theGodfather = { | |
| budget: 7200000, | |
| director: 'Coppola', | |
| title: 'The Godfather' | |
| } | |
| function analyze (data, key) { | |
| const value = movie[key] | |
| console.log('The', key, 'is', value) | |
| return value | |
| } | |
| function formatString (value) { | |
| const formatted = value.toUpperCase() | |
| console.log(formatted) | |
| } | |
| function formatNumber (value) { | |
| const formatted = value.toFixed(2) | |
| console.log(`$${formatted}`) | |
| } | |
| const author = analyze(theHobbit, 'author') | |
| formatString(author) | |
| const director = analyze(theMatrix, 'director') | |
| formatString(director) | |
| const pages = analyze(watchmen, 'pages') | |
| formatNumber(pages) | |
| const budget = analyze(theGodfather, 'budget') | |
| formatNumber(budget) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment